i have an element in my page.
<div id="element">try</div>
I want hide it when i click in others elements in the page.
How can i do it?
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 can take advantage of bubbling here, like this:
If you click on the
#element, it stops the bubble (usingevent.stopPropagation()) from going all the way up todocumentand firing it’sclickhandler. If anywhere else is clicked it does bubble up, and when the click reaches document, it hides#element.