JS阻止事件冒泡与浏览器默认行为

阻止冒泡

W3C的方法是e.stopPropagation()

IE是e.cancelBubble = true;

阻止默认行为

W3C的方法e.preventDefault(),

IE是e.returnValue=false

return false

原生js的return false只会阻止默认行为,不会阻止冒泡。

jQuery的return false既阻止默认行为,又阻止冒泡。

原文地址:https://www.cnblogs.com/lianglanlan/p/8035372.html