Home  >  Article  >  Web Front-end  >  jquery事件preventDefault()方法用法实例_jquery

jquery事件preventDefault()方法用法实例_jquery

WBOY
WBOYOriginal
2016-05-16 16:20:001259browse

本文实例讲述了jquery事件preventDefault()方法用法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:


jquery事件:preventDefault()方法的使用









补充说明:

(1)如果想获取事件的相关信息,则给匿名函数添加一个参数。例子中的e表示事件的对象。
(2)通过调用事件对象的preventDefault()方法,能够阻止默认行为的发生(如例子中的发送到http://www.baidu.com)。

另外,调用事件对象的stopPropagation()方法,能够阻止冒泡事件的发生。关于冒泡模型与捕捉模型,可参考另外一篇文章《js中的事件捕捉模型与冒泡模型实例分析》。

希望本文所述对大家的jQuery程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn