I'd like to see all the events fired by an input field as a user interacts with it. This includes stuff like:
- Clicking on it.
- Clicking off it.
- Tabbing into it.
- Tabbing away from it.
- Ctrl+C and Ctrl+V on the keyboard.
- Right click -> Paste.
- Right click -> Cut.
- Right click -> Copy.
- Dragging and dropping text from another application.
- Modifying it with Javascript.
- Modifying it with a debug tool, like Firebug.
I'd like to display it using console.log
. Is this possible in Javascript/jQuery, and if so, how do I do it?
I have no idea why no-one uses this... (maybe because it's only a webkit thing)
Open console:
monitorEvents(document.body); // logs all events on the body
monitorEvents(document.body, 'mouse'); // logs mouse events on the body
monitorEvents(document.body.querySelectorAll('input')); // logs all events on inputs