开发者

jQuery focus() not quite working after first show() in IE

I have a TextBox I want to move the focus to after showing it. The problem is that on the initial show(), it will get focus during the show animation but it's gone after. What's up?

It works fine in FireFox, but not IE8. I have a running example here:

http://jsfiddle.net/3PDLb/

Also, here is the code:

<input id="Button1" type="button" value="button" /><br />
<div id="Div1" style="display:none">
    <input id="Text1" type="text" />
</div>
<input id="Text2" type="text" />

$("#Text2").focus();

$("#Button1").click(function开发者_运维知识库(){
    $("#Div1").toggle("slow").find("input:text").focus();
});


Not really an answer to the question, but a workaround:

$("#Div1").toggle("slow", function(){$(this).find("input:text").focus()});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜