I tried both Hector's suggestion and Karl's, neither solved the problem. In both cases the field has focus while it's sliding in, then when the animation is done focus is lost. Oddly, I noticed if I navigate away from this page by going to another tab in FF, when I return to this page the field *has* focus. Strange. This doesn't happen in Safari.
I'm pulling my hair out, any other ideas? Am I doing something wrong?? S On Aug 26, 7:28 pm, Karl Swedberg <k...@englishrules.com> wrote: > If Hector's suggestion doesn't work, try using preventDefault() > instead of return false: > > $(function() { > $("#login a").click(function(event) { > event.preventDefault(); > $("#login").animate( { width: 300, height: 20 }, 500); > $("#login a").hide("slide", null, 500, loginCallback); > }); > > }); > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Aug 26, 2009, at 1:20 AM, shenry wrote: > > > > > I have an anchor tag that, when clicked, reveals a login form. I'd > > like the first field in the form to have focus when its revealed, and > > I can see that it does as it's being revealed in the slide animation > > but then focus is lost after return false; > > > any ideas? > > > Here is my code.... I'm new to jQuery, so any help is appreciated > > > $(function() { > > $("#login a").click(function() { > > $("#login").animate( { width: 300, height: 20 }, 500); > > $("#login a").hide("slide", null, 500, loginCallback); > > return false; > > }); > > }); > > > function loginCallback() { > > $("#login_form").show("slide", null, 1000); > > $("input.focus").focus(); > > } > > > Thanks, > > > Stu