jQuery阻止事件冒泡
来源:互联网 发布:linux卸载jdk1.5 编辑:程序博客网 时间:2024/05/17 07:36
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>jQuery case-2</title><style type="text/css"> #d1{ width:300px; height:300px; background-color:red; margin:10px auto; position:relative; } #d2{ width:200px; height:200px; background-color:blue; position:absolute; top:50px; left:50px; } /*父元素已经定位了,则以父元素为参照物 */ #d3{ width:100px; height:100px; background-color:yellow; position:absolute; top:50px; left:50px; }</style><script type="text/javascript" src="../js/jquery-1.11.1.js"></script><script type="text/javascript"> /* 点击父、子元素时弹出提示信息 点击子元素时取消事件冒泡 */ $(function(){$("div").click(function(e){ //获取事件源 var info = $(this).html(); //取消事件冒泡 e.stopPropagation(); console.log(info); console.log(e.target);//事件源<div id="d3">div3</div> }); });</script></head><body> <div id="d1">div1 <div id="d2">div2 <div id="d3">div3</div> </div> </div></body></html>
0 0
- jQuery阻止事件冒泡
- Jquery 阻止事件冒泡
- 阻止jQuery事件冒泡
- 阻止jQuery事件冒泡
- jquery阻止事件冒泡
- 阻止jQuery事件冒泡
- jquery阻止事件冒泡
- 阻止jQuery事件冒泡
- jquery阻止事件冒泡
- jQuery事件冒泡阻止
- JQuery阻止事件冒泡
- jquery阻止事件冒泡
- JQuery阻止事件冒泡
- jquery 阻止事件冒泡
- jQuery阻止事件冒泡
- jQuery阻止事件冒泡
- jQuery阻止事件冒泡
- jQuery阻止事件冒泡
- [勇者闯LeetCode] 111. Minimum Depth of Binary Tree
- Searching and Sorting
- C语言学习历程——Training01整数算法训练04
- ROS学习笔记(四) 先锋机器人跟随
- Linux内核TCP/IP参数分析与调优
- jQuery阻止事件冒泡
- javaweb项目在tomcat中去掉端口去掉项目名访问
- CSDN日报20170429 ——《程序修行从“拔刀术”到“万剑诀”》
- [编程题] 买帽子
- Resource Descriptors for ACPI
- 【NodeMCU】关于NodeMCU烧写的坑(load 0x33333333, len 858993459, room 0)
- 内存调优工具-valgrind 的使用简介
- 236. Lowest Common Ancestor of a Binary Tree
- 我眼中的红帽系统