jQuery('div').not("#supcont").bind('click', function() {
jQuery("#supcont").slideUp("slow");
});
On:
jQuery("#supcont").click();
Acts like #supcont is not exluded. Why?
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.
It should work fine. The only reason I can think of that it may not, is that your
#supcontelement is a descendant of adiv, and as the click event will bubble up, thedivwill receive it. To prevent that happening, you can use thestopPropagationmethod of the event object:Update (see comments)
Actually, the above won’t help you if
#supcontis a descendant of anotherdiv, you will need to capture the event on#supcontand stop it there. So bind a click event handler to#supconttoo: