0

Is there anyway to capture all the events in a page dynamically through JavaScript / jQuery code. For example, if I click on a button I should know that onclick of a button happened through some code.

Please help me in capturing all the events dynamically. I know this can be done using monitorEvents in Chrome and Firefox, but I want to capture the events through some code.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Srinivas B
  • 1,821
  • 4
  • 17
  • 35
  • This is quite vague. Yes, you can capture events like clicks, mouse over, mouse position,etc. Provide an example of the HTML you are trying to capture events in – Cory Dec 31 '15 at 05:08
  • @Cory, he probably wants to add a single callback to all events. – 11thdimension Dec 31 '15 at 05:10
  • @Srinivas have you explored the possibility of catching event on the top node when it's bubbling down ? As long as nodes are proper children (not position fixed or absolute kind) you'll be able to know that even was invoked. – 11thdimension Dec 31 '15 at 05:14
  • @Cory I am not sure how to capture all the events. – Srinivas B Dec 31 '15 at 05:15
  • I believe what you want is: `document.addEventListener('click', delegator, false);` `document.addEventListener('touch', delegator, false);` `document.addEventListener('mouseover', delegator, false);` etc... Then everything that happens in the document is listened to. – colecmc Dec 31 '15 at 05:19
  • Take a look at this : http://stackoverflow.com/questions/25695913/capture-all-the-events-javascript. Might help you. – Maddy Dec 31 '15 at 06:28

0 Answers0