Is there a way I can call the second function in toggle(function(){},function(){})
Is there a way I can call the second function in toggle(function(){},function(){})
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could skip the toggle to the next function, if you really wanted to I suppose, for example:
Then you can manually advance the
.toggle()function array (without calling the first function), like this:Then just click the element or
$("div").click(), etc, and it’ll fire the second function.You can give it a try here, note that this only works in jQuery 1.4+ and is really just to show it’s possible. You should however either bind them in reverse order, or give the second argument a named function as the other answers suggest.