I am trying to hide an element after 2000ms by the below code.
setTimeout($templateElement.hide(),2000);
I am the new one to jquery and java-script. I hope Anyone clear my doubts.
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.
The code
executes the
$templateElement.hide()immediately and passes its return value (a jQuery object) intosetTimeout. You may have meant:…which passes a function reference into
setTimeout, to be called two seconds later. That function then does thehidewhen it gets called.