jQuery event.preventDefault() 方法
jQuery 教程
· 2019-03-11 06:13:48
实例
防止链接打开 URL:
$("a").click(function(event){
event.preventDefault();
});
event.preventDefault();
});
定义和用法
event.preventDefault() 方法阻止元素发生默认的行为。
例如:
- 当点击提交按钮时阻止对表单的提交
- 阻止以下 URL 的链接
提示:请使用 event.isDefaultPrevented() 方法来检查指定的事件上是否调用了 preventDefault() 方法。
语法
event.preventDefault()
| 参数 | 描述 |
|---|---|
| event | 必需。event 参数来自事件绑定函数。 |
点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html
Learn Python the Hard Way
Zed Shaw / Example Product Manufacturer / 2011
This is a very beginner book for people who want to learn to code. If you can already code then the book will probably drive you insane. It's intended for people who have no coding chops to build up t......一起来看看 《Learn Python the Hard Way》 这本书的介绍吧!