Possible Duplicate:
How to find event listeners on a DOM node?
Given an element, let's say a div
, is it possible to obtain a list of the handlers bound to a specific event fired by the element?
/* pseudo code: click on a div handlers? */
document.getElementById('myDiv').getHandlers('click');
Edit
Ok, here's some more details. I want to bind a click handler to a div, unless another handler is already bound to the div. What I have in mind is the following:
/* pseudo code: click on a div handlers? */
if(!document.getElementById('myDiv').getHandlers('click'))
document.getElementById('myDiv').addEventListener('click', myEventhandler);
No comments:
Post a Comment