How can I find all items that do not have an onkeyup event?

  • Perhaps you had an introduction I do not have subscribers to the event? - Zowie
  • If the events were hung using the library - then you can get such data. The library, as a rule, keeps track of events passing through it. In the native js there is no function to get the list of events - istem
  • ideally, those elements are needed in which onkeyup <b href = "" onkeyup = ""> </ b> were manually assigned in the tag - IVsevolod
  • @istem you are wrong, there is already a specification, albeit a new one: [ EventListenerList] [1] [1]: w3.org/TR/2001/WD-DOM-Level-3-Events-20010823/… - lampa
  • Hmm Thank. Quote: "Do not change objects that you do not own" - istem

2 answers 2

You can highlight this:

$("element:not([onkeyup])") 

JSFiddle example .
But this is a very simple case when an event is set via HTML. If an event is hung via on , then you can write your own wrapper for on , for example:

 function myLive(filter, event, func){ $(filter).data("hasLiveEvent", true); $(filter).on(event, func); }; 

An example here is http://jsfiddle.net/8cdez/1/
But in this case it will not be possible to select elements that were created dynamically, but you can set the data yourself when creating a new element.

 $('*').each(function() { console.log($(this).data("events")); }); 

Updated:

 $('*').each(function() { if($._data(this, "events") == undefined) { //... } }); 
  • hmm, doesn't work either. - lampa
  • updated the post, in the new versions of jQuery removed .data ('events') - lampa