javascriptjqueryeventsjquery-eventsunbind

Removing all Javascript events from a page and putting them back


I'd like to "pause" all the events of a page which means removes all the event set... and be able to put them back after.

Even the first part = removing all the events of a page, I don't see how to do so! Do you have ideas?

I don't find anything working for it!

Edit:

Why? I want to act in a page already loaded. The user will interact with the page and I want to control the interaction... so remove all the interactions previously set.


Solution

  • Here is the currently solution I use: it doesn't solve the problem totally!

    I stop the event during the capture phase: I put a listener on the document object to listen to all events in the capture phase and stop propagation.

    +:

    -:

    Do you have a better solution?

    P.S.: I'll continue to update this post if I find a better solution