Find online items

Is there a way to find all the elements that can be clicked using the click () or live ('click) button?

I want to perform some actions if any of these elements are clicked.

$('.container').bind('click', function(event) { // actions }); 

This object catches all clicks.

Thanks.

+4
source share
1 answer

This will be done:

 $.each($('.container').find("*").andSelf().data("events"), function(i, event) { $.each(event, function(j, h) { if(j = 'click') { //Do stuff to $(this) alert(j); alert(h.handler); //Gets the actual handler for each event ( inject code >=] ) } }); }); 

Working jsfiddle

http://jsfiddle.net/vFaAK/

+5
source

Source: https://habr.com/ru/post/1395875/


All Articles