How to trace or debug all available javascript events

前端 未结 4 1343
你的背包
你的背包 2020-12-04 12:26

How can I trace all Javascript events of a web page?

Is there a possibility to trace all events, even such without a handler attached?

Is there any tool out th

4条回答
  •  隐瞒了意图╮
    2020-12-04 13:08

    Here's a simple script to log all available events in the browser's console:

    var ev = '',
        out = [];
    for (ev in window) {
        if (/^on/.test(ev)) { 
            out[out.length] = ev;
        }
    }
    console.log(out.join(', '));
    

    Of course you'll get only the events of the browser you're currently using.

提交回复
热议问题