 <p>I think you meant to use setTimeout instead of setInterval; it's continuously running that loop every second which is what's causing the focus to jump back to the first input box.</p> <p>If you want the animation to happen after the slideUp animation is complete, use the callback argument of the slideUp method instead of relying on setTimeout.</p> <p>For example:</p> <pre><code>$("#openc").click(function(){ $("#close-top").slideUp(450,function() { $("#open-me").slideDown(); $("#regkey").focus(); $("#closec").show(); }); $("#openc").hide(); }); </code></pre>