我希望看到用户与输入字段 交互时触发的所有事件。这包括以下内容:
- 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.
我想使用 console.log
显示它。这在 Javascript/jQuery 中是否可行?如果可行,我该怎么做?
最佳答案
我不知道为什么没有人使用这个...(也许是因为它只是一个 webkit 的东西)
打开控制台:
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
关于javascript - 你如何记录由 jQuery 中的元素触发的所有事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7439570/