Click here to see example
http://www.messtudios.com/form/
Now, when you click on Create Account – there is a slide animation with jquery, and then the first input field focuses.
$("#openc").click(function(){
$("#close-top").slideUp(450);
$("#openc").hide();
setInterval(function() {
$("#open-me").slideDown();
$("#regkey").focus();
$("#closec").show();
}, 1000);
});
The problem I am having is that when I try and focus on another input field to enter information in, the focus skips back to the first input field ( i guess its something wrong with setInterval
Any Help would be appriciated in advance.
Thanks,
-O
EDIT:
This worked thanks… Also the below works
$("#openc").click(function(){
$("#close-top").slideUp(450);
$("#openc").hide();
setTimeout(function() {
$("#open-me").slideDown();
$("#regkey").focus();
$("#closec").show();
}, 1000);
});
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.
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.
For example: