我有一个可点击的DIV,并且我试图在此DIV中放置一个按钮。单击按钮时,发生的事件与单击DIV时发生的事件不同。
当前,当我单击按钮时,将同时触发DIV和按钮。单击按钮后,有什么方法可以阻止DIV触发?
<div class="stack">
<div class="background" onclick="alert('background clicked');">
<button onclick="alert('bg-button clicked');" style="left:65px; top:65px; position: absolute;">This is a background button</button>
<div class="card">
<button onclick="alert('card-button clicked');">This is a card button</button>
</div>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句