Reputation: 13145
When you upload files in IE (at least in IE8) you can double click on the field instead of clicking browse. The problem if you do this is when you return to the form after selecting a file. It will look like this:
IE will select the text in the field no matter where you move your mouse on the page (It releases focus if you click anywhere though)
This will not happen if you click the browse button to begin with, it only occurs when double clicking the input field.
Now, is there a way to make the field behave the same way, whether you click the button or double click the field? Like setting focus on some other part of the form.
It's starting to annoy me.
Upvotes: 1
Views: 1223
Reputation: 5903
The following works for me:
// Fix bug on IE 11
$("input[type='file']").click(function() {
var $this = $(this);
$this.hide();
setTimeout(function() {
$this.show();
});
});
Upvotes: 0
Reputation: 2017
You basically want to tap in to the "onchange" event and then set the focus elsewhere: HTML File input JS events
I was able to get the IE8 highlighting to go away using jQuery and this code (where "up" is the id of your file input):
$(document).ready(function() {
$("#up").change(function() {
$(document).focus();
});
});
Upvotes: 1