my mouseleave is not working in my jquery code
http://jsfiddle.net/alano/9Dr7T/29/
providing my js code below
mouseleave: function () {
$(this).find("div:last").remove();
}
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 problem isn’t with the
mouseleavelistener, the problem is how you’re binding those event handlers and unbinding them for that matter. The div was being removed, but it was being readded with everymouseenterevent. For some reason the mouseenter event wasn’t being unbound when using the selector filter for.on(). It probably has something to do with the way bubbling occurs when using the selector filter.Now, I’m not 100% sure why just yet, but either way it will work if you use directly-bound handlers like so:
See: http://jsfiddle.net/9Dr7T/35/