how can i unbind only the "all selector"?
I try $("*").unbind();
but than jquery unbinds my $('#demo').click(function())};
too.
HTML
<div id="hv_t"></div>
<br /><br /><br />
<hr />
<br /><br /><br />
<div id="demo">Demo</div>
<br /><br /><br />
<div id="unbindHover">unbindHover</div>
$('#demo').click(function()
{
alert('click');
});
$('#unbindHover').click(function()
{
alert('unbind hover');
$("*").unbind();
});
$("*").hover( function (e)
{
$('#hv_t').append('+');
}, function ()
{
$('#hv_t').append('-');
});
To unbind a specific event binding, specify the event and handler in the unbind
method. The hover
method is a shortcut for binding the mouseenter
and mouseleave
events, so it's those that you need to unbind:
$("*").hover(handleEnter, handleLeave);
function handleEnter() {
$('#hv_t').append('+');
}
function handleLeave() {
$('#hv_t').append('-');
}
$('#unbindHover').click(function() {
$("*").unbind('mouseenter', handleEnter).unbind('mouseleave', handleLeave);
});