小编San*_*aab的帖子

为什么JSON.stringify只显示click事件的isTrusted成员?

HTML:

<button onclick="foo(event);">Test</button>
Run Code Online (Sandbox Code Playgroud)

使用Javascript:

window.foo = function(event) {
  console.log(JSON.stringify(event));
}
Run Code Online (Sandbox Code Playgroud)

控制台结果:

{"isTrusted":true}
Run Code Online (Sandbox Code Playgroud)

它发生在Chrome上.我还没有测试过其他浏览器.

javascript json dom-events

7
推荐指数
1
解决办法
1467
查看次数

标签 统计

dom-events ×1

javascript ×1

json ×1