我想要一个引用来查找 event.target 的所有属性



>我正在学习JS,我有一个函数,它有一个事件(e(作为参数现在我可以使用 e.target 访问目标,但现在我想在 e.target.style(在 mdn 页面中(中查看所有不同的样式属性,但我找不到该页面。有人可以帮我找到页面吗?

您可以通过在

控制台中记录event然后找到target密钥来进行检查。

或者,您也可以使用window.getComputedStyle

function getAllProps(e) {
  console.log(e)
}
<button type='button' onclick='getAllProps(event)'>Click</button>

最新更新