Hover on click
by Rui Figueiredo
HTML
<div style="height:100px; width:100px; background:gray">
</div>
<button id="btAdd">add click handler</button>
<button id="btRemoveAll">remove all</button>
CSS
button { display: block; }
JavaScript
$.event.special.click = {
setup: function(){
$(this).css("cursor", "pointer");
return false;
},
teardown: function(){
$(this).css("cursor", "");
return false;
}
};
$('#btAdd').click(function(){
$('div').click(function(){
alert('clicked');
});
});
$('#btRemoveAll').click(function(){
$('div').off("click");
});