Jquery fire on any event

Is there any way to say in any fire event

    $('#foo').bind('click', function() {
          alert($(this).text());
     });

I am trying to check a piece of code for a specific event and am not going to go there. I just want him to shoot ANY case.

    $('#foo').bind('ANY', function() {
          alert($(this).text());
     });
+3
source share
3 answers

There is no transcript to listen to all the events.

The closest thing you can get out of the box will indicate them manually:

$('#foo').bind('blur change click dblclick focus focusin focusout hover keydown ...', function() {
    alert($(this).text());
});

Please note that plugins can trigger their own events, possibly with names. You cannot listen to these events without knowing them and manually pointing them out.

+2
source

, bind. . , jquery, .

0

I do not think this is possible, but you can use Firebug to view all the events related to the page element.

Open Firebug, and then in the console, write the following:

$("#foo").data("events"); 

This should display any event associated with the #foo element.

0
source

All Articles