javascript - Is there a JQuery function to handle all mouse events at once? -


What is a JQuery function (or plugin) to handle at once?

For example, to handle all click events on a page, I $ ("*"). Click () , but I'm thinking that there is such a function:

  $ ("*"). Mouse Event ("event type", function () {// handle all events based on their event type in an event list});    

Delegate event handling to hear you for all mouse events through event propaganda You can use. You can pass multiple event names in the same event handler. You can see the event parameter, when there is a fire to look at the incident, in which the event occurred, where the DOM object

  $ (document) .on ("mouseup mousedown click mousemove", function (e) {// e.type is the type of event / / e.target element originally happened}} is;);   

The advantage of this is that it works for all the elements of the page, even the dynamic objects are included, you have been added after installing the event handler.

The only way to do this is to prevent the default behavior of the event, because it can already be processed by an event handler attached to an object (except that you e.preventDefault () because they apparently do not seem to fire until the event spread.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -