Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Problems with parent’s jQuery mouseover/mouseout events

Hello Friends,

Today i was working with jQuery mouseover/mouseout event and i faced a problem with it. Here i am giving you a quick note which may save you time in future. The problem is related to parent and its children elements. Your parent element has children elements and your parent element have mouseover/mouseout event. Now when you mouseover/mouseout on children element, it fires parent's mouseover/mouseout event. This is caused by event bubbling/propagation.

Below is the solution to this particular problem.

Use $('#id').mouseenter(); instead of $('#id').mouseover(); You should use the mouseenter/mouseleave events instead of mouseover/mouseout.

If you find any problem in this than let me know by comment.



Leave a Reply

Your email address will not be published.