我有以下代码:
<a id="clickme" href="#">
<span>Text for link goes here</span>
<button id="deleteme">X</div>
</a>
和以下javascript:
$("body").on('click', "#clickme", function(e) {
//stuff here
});
$("body").on('click', "#deleteme", function(e) {
//stuff here
});
如何使我单击
#deleteme
时,单击#clickme
的click事件不会运行? 最佳答案
$("body").on('click', "#deleteme", function(e) {
e.stopPropagation();
});