jq 阻止冒泡事件和浏览器的默认行为

<a href="http://www.baidu.com" id="link">百度</a>
<script src="jquery-1.12.4.js"></script>
<script>
$(function () {
$("#link").on("click",function (e) {
alert("呵呵呵");
e.preventDefault();//阻止浏览器的默认行为
e.stopPropagation();//阻止事件冒泡
return false;//既能阻止事件冒泡,也能阻止浏览器的默认行为
});
$("body").on("click",function () {
alert("哈哈");
});
});
</script>
原文地址:https://www.cnblogs.com/lujieting/p/10110810.html