概述

返回一个布尔值,表明当前事件是否调用了 event.preventDefault()方法。

注意:你应该使用该属性来代替以前的非标准的已经被废弃的getPreventDefault()方法 (查看bug 691151).

语法

bool = event.defaultPrevented

示例

 if (e.defaultPrevented) {
   /* 事件的默认动作已被取消*/
 }

规范

Specification Status Comment
DOM
Event.defaultPrevented()
Living Standard  

浏览器兼容

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 18Edge Full support YesFirefox Full support 6IE Full support 9Opera Full support 11Safari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 6Opera Android Full support 11Safari iOS Full support 5Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

文档标签和贡献者

标签: 
此页面的贡献者: zhangchen, teoli, khalid32, ziyunfei
最后编辑者: zhangchen,