Reputation: 42185
I have jQuery which produces a popup window, as outlined here:
http://www.jsfiddle.net/sLjfx/4/
The problem is that the following line:
$('#txtValuation').focus();
doesn't seem to want to work in IE8. The popup will load, but the textbox doesn't have focus, where in Chrome the box does have focus.. Is there any work-around for it?
Upvotes: 4
Views: 5128
Reputation: 1074295
I don't have IE8 handy, but try this: I fired up my Windows VM, and this works: http://www.jsfiddle.net/n25HE/ All I did was wrap the focus
call in a function and call it 10ms after your event handler finished, like this:
setTimeout(function() {
$('#txtValuation').focus();
}, 10);
This gives IE time to actually render the content and create the OS control for the text input. IE can't focus things before the underlying control exists.
Upvotes: 8