How can I remove the No file chosen tooltip from a file input in Chrome?
This is a native part of the webkit browsers and you cannot remove it. You should think about a hacky solution like covering or hiding the file inputs.
A hacky solution:
input[type='file'] {
opacity:0
}
<div>
<input type='file'/>
<span id='val'></span>
<span id='button'>Select File</span>
</div>
$('#button').click(function(){
$("input[type='file']").trigger('click');
})
$("input[type='file']").change(function(){
$('#val').text(this.value.replace(/C:\\fakepath\\/i, ''))
})
Fiddle
Change the No file chosen:
I'm pretty sure you cannot change the default labels on buttons, they are hard-coded in browsers (each browser rendering the buttons captions its own way). Check out this button styling article
hiding a No file chosen tooltip in Javascript
This finally works well:
var obElement = document.getElementsByClassName('input-file')[0];//the title property overrides tooltip's descriptionobElement.setAttribute('title', ' ');
.flex-style{ display: flex;}
.input-file{ opacity: 0; margin-left: -40px; width: 40px; height: 45px;}
.icon{ width: 40px; height: 45px; background-color: blueviolet; }
<div class='flex-style'><div class='icon'></div><input class='input-file' type='file'></div>
Remove no file chosen according to condition
You can use CSS class and a bit of js for this:
@if(Model.value != null){
<input type="file" onchange="fileOnchange(this)" class="notext"/>
<script>
function fileOnchange(el){
if(el.value){
el.className = "";
}
else{
el.className = "notext";
}
}
<script/>
<style type="text/CSS">
.notext{
color: transparent;
}
<style/>
}
else
{
<input type="file" />
}
How to remove no file selected from type=file inputs?
There is no cross-browser way to do this. The "no file selected" text is in the implementation-defined part of the widget, and I don't believe that most browsers offer much in the way of browser-specific customization. On the other hand, you could simply use CSS to cover the text with something when the value attribute is empty.
How to hide No file chosen text on xp:fileUpload control?
Use this answer which basically creates a styled span that hides the underlying input file button: https://stackoverflow.com/a/9164004/785061
Disable link reference tooltip in browsers
you could do it in older browsers, which would hide the status bar.
But to switch it off manually you could put this script in page somewhere...it removes href tag attaches onclick event listener...
$("body").on('mouseover', 'a', function (e) {
var $link = $(this),
href = $link.attr('href') || $link.data("href");
$link.off('click.chrome');
$link.on('click.chrome', function () {
window.location.href = href;
})
.attr('data-href', href) //keeps track of the href value
.css({ cursor: 'pointer' })
.removeAttr('href'); // <- this is what stops Chrome to display status bar
});
Related Topics
JavaScript Localstorage Object Broken in Ie11 on Windows 7
How to Change a <Select> Value from JavaScript
Image Manipulation and Texture Mapping Using HTML5 Canvas
Where Should I Put the CSS and JavaScript Code in an HTML Webpage
How to Determine If a Checkbox Is Checked
How to Auto-Submit an Upload Form When a File Is Selected
Detect Input Value Change with Mutationobserver
Get Caret Index in Contenteditable Div Including Tags
Sort an HTML List with JavaScript
Flow 2 Columns of Text Automatically with CSS
Html5 Filereader How to Return Result
How to Exchange Variables Between Two HTML Pages
Programmatically Play Video with Sound on Safari and Mobile Chrome
Multicolor Text Highlighting in a Textarea or Text Input
Vuejs Error: the Client-Side Rendered Virtual Dom Tree Is Not Matching Server-Rendered