概述
返回一个布尔值,表明当前事件的默认动作是否被取消,也就是是否执行了 event.preventDefault()方法.
注意:你应该使用该属性来代替以前的非标准的已经被废弃的
getPreventDefault()方法 (查看bug 691151).语法
bool = event.defaultPrevented
例子
if (e.defaultPrevented) {
/* 事件的默认动作已被取消*/
}
浏览器兼容性
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 18 (18) | 6.0 (6.0) | 9 (9) | 11 (11) | 5.0 (5.0) |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | ? | 6.0 (6.0) | ? | ? | 5.0 (5.0) |