概述
返回一个布尔值,表明当前事件是否调用了 event.preventDefault()
方法。
注意:你应该使用该属性来代替以前的非标准的已经被废弃的
getPreventDefault()
方法 (查看bug 691151).语法
bool = event.defaultPrevented
示例
if (e.defaultPrevented) {
/* 事件的默认动作已被取消*/
}
规范
Specification | Status | Comment |
---|---|---|
DOM Event.defaultPrevented() |
Living Standard |
浏览器兼容
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.