js 事件防止冒泡 event.stopPropagation()
作者:互联网
<div id="app">
<button id="btn">click</button>
</div>
const btn = document.getElementById('btn');
btn.addEventListener('click', function(event){
event.stopPropagation();//阻止冒泡
}, false);
btn.onclick = function(event) {
event.stopPropagation();
}
标签:function,js,click,冒泡,btn,stopPropagation,event 来源: https://www.cnblogs.com/Lilc20201212/p/15367795.html