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 Swedberg
www.englishrules.com
www.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

Reply via email to