views:

16

answers:

1

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();
});
A: 

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

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