Reputation: 5330
I have try to focus while onblur Event. it works on chrome not on firefox. how to sort out.
function a() {
$("#login").focus();
}
$(document).ready(function() {
$("#login").focus();
});
<input id="login" onblur="a()"></input>
Please help.
Upvotes: 1
Views: 107
Reputation:
You can just remove the onblur
function and write instead:
$(document).ready(function () {
$("#login").focus();
$(document).on('click', function () {
$("#login").focus();
});
});
Live jsfiddle: http://jsfiddle.net/ysjkzvh7/
Upvotes: 2
Reputation: 1051
If you don't want the input to lose focus, just unbind the blur function from it.
Try this -
$(document).ready(function() {
$("#login").unbind('blur');
});
Upvotes: 1
Reputation: 972
Do something like that;
$( "#login" ).blur(function() {
$(this).focus();
});
and
<input id="login"></input>
just try different things. But every browser is different.
Upvotes: 1