Trying to remove an appended div, I’ve tried .empty() and contents().remove();
I’ve commented out the removed code, see: http://jsfiddle.net/2Aw23/2/
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.
Is this what you want?
JS fiddle demo
It will add the div when the button is clicked, but then remove it when anything else is clicked. But note that other code may also specify that clicks on other parts of the page should stop propagation, so if that is the case, clicking those elements also will not remove the div.