jquery - How to disable/enable custom click event for an img element in JavaScript -
i have asp.net datepicker control (no source available ) produces image element, when clicked shows calendar. want disable or enable on demand image through javascript. when added 'disabled' attribute img element, script in page goes in busy state , page never finishes rendering. guess disabled attribute causing conflict in way.
my next attempt disable custom click event asp.net control adds unoptrusively. how disable click event? how re-enable img works normal. using jquery 1.4.
var $img = $('img#yourid'), handler = $img.get(0).onclick; // previous click handler // unbind $img.unbind('click').click(function(){ alert('new click'); }); // rebind $img.unbind('click').click(handler);
you might need check other events (mousedown mouseup etc).
Comments
Post a Comment