Reputation: 195
Here is my code:
jQuery('#reporter').blur(function() {
if(data.indexOf('['+jQuery('#reporter').val()+']') >= 0)
{
alert("Please do not select pseudo user as Reporter");
jQuery('#reporter').focus();
}
});
In IE, the cursor is not blinking in the "reporter" element. In Chrome, it is.
Thanks a lot!
Upvotes: 11
Views: 16159
Reputation: 33381
You'll need to set the blur later by using a timeout. The other control might execute focus first.
window.setTimeout(function(){
$('#reporter').focus();
}, 50);
This gives IE the time to focus the other control, steal the focus and then add it to #reporter
.
$('#reporter').blur(function(e) {
if(data.indexOf('[' + jQuery('#reporter').val() + ']') >= 0) {
alert("Please do not select pseudo user as Reporter");
$('#reporter').focus();
e.preventDefault();
}
});
Upvotes: 18