I want to disable all click events on my page but some of events are still getting called, suppose I have html as below
try this plugin to temporary disable onclick
AND jQuery click
events:-
$.fn.disableClick = function (disable){
this.each(function() {
if(disable){
if(this.onclick)
$(this).data('onclick', this.onclick).removeAttr('onclick');
if($._data(this, 'events') && $._data(this, 'events').click)
$(this).data('click', $.extend(true, {}, $._data(this, 'events').click)).off('click');
}
else{
if($(this).data('onclick'))
this.onclick = $(this).data('onclick');
if($(this).data('click'))
for(var i in $(this).data('click'))
$(this).on('click', $(this).data('click')[i].handler);
}
});
return this;
};
//disable clicks
$('#parent *').disableClick(true);
//enable clicks
$('#parent *').disableClick(false);
DEMO