星空网 > 软件开发 > Java

jQuery阻止事件冒泡实例代码

jQuery阻止事件冒泡实例代码:
关于事件冒泡的定义这里就不介绍了,具体可以参阅什么是jquery事件冒泡一章节。下面直接给出一段阻止事件冒泡的实例代码,直接参考一下就可以了,代码如下:

 

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>事件冒泡-蚂蚁i部落</title><script type="text/javascript" src='/images/loading.gif' data-original="http://www.softwhy.com/mytest/jQuery/jquery-1.8.3.js"></script><script type="text/javascript"> $(document).ready(function(){  $("#third").click(function(e){   alert("我是third");       e.stopPropagation();  })  $("#second").click(function(){   alert("我是second");      })  $("#first").click(function(){   alert("我是first");      }) }) </script></head><body><div id="first"> <div id="second"> <a id="third" href="http://www.softwhy.com">点击查看效果</a> </div></div></body></html>

 

以上代码可以阻止事件冒泡效果,代码非常的简单,这里就不多介绍了。
相关阅读:
1.stopPropagation()函数可以参阅jQuery的event.stopPropagation()方法一章节。 
2.阻止事件冒泡可以参阅如何阻止jQuery事件冒泡现象一章节。
3.原生javascript如何阻止事件冒泡可以参阅javascript如何阻止事件冒泡一章节。 

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=9491

更多内容可以参阅:http://www.softwhy.com/jquery/

 




原标题:jQuery阻止事件冒泡实例代码

关键词:jquery

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

寄产品到越南:https://www.goluckyvip.com/tag/105983.html
货运走越南:https://www.goluckyvip.com/tag/105984.html
越南-中国物流:https://www.goluckyvip.com/tag/105985.html
物流去越南:https://www.goluckyvip.com/tag/105986.html
药品寄到越南:https://www.goluckyvip.com/tag/105987.html
深圳物流越南:https://www.goluckyvip.com/tag/105988.html
在古巴做游轮 古巴旅游项目:https://www.vstour.cn/a/363194.html
西藏旅游攻略自驾游需要多少天 去西藏旅游自驾游要多久时间:https://www.vstour.cn/a/363195.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流