tags:

views:

804

answers:

2

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

+5  A: 

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');
CMS
You can combine those calls: `.unbind('mouseover mouseout');`
nickf
Thanks @nickf, edited to add your recommendation.
CMS
It still doesn't work
Mask
Is it because the listener is added by $.hover(),not by $.bind()?
Mask
@Mask, take a look to this example: http://jsbin.com/ibine
CMS
i have added the listener by .hover() and it removed fine by .unbind()
takpar
A: 

You could also try:

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

cam8001
Binding extra event handlers to an object does not override previously bound handlers. This may well work, since the `return false` may stop the propagation, but it's not a great solution.
nickf