Home » Jquery » How to remove $.hover event added by jQuery?

How to remove $.hover event added by jQuery?

Posted by: admin November 30, 2017 Leave a comment

Questions:

I tried $.unbind('hover'), which is not working.

Answers:

The hover function it’s just a short-hand to bind two handlers to the mouseenter and mouseleave events, you should unbind them:

$('#item').unbind('mouseenter mouseleave');

Questions:
Answers:

Api documentation on hover:

Example: To unbind the above example use:

$("td").off('mouseenter mouseleave');

Questions:
Answers:

tringger unbinding with a click

$('.item').click(function() { 
 $('.item').unbind('mouseenter mouseleave');
});

Questions:
Answers:

You could also try:

$('#item').bind('hover', function(){return false})