Reputation: 9369
I have the following code:
<a id="clickme" href="#">
<span>Text for link goes here</span>
<button id="deleteme">X</div>
</a>
And the following javascript:
$("body").on('click', "#clickme", function(e) {
//stuff here
});
$("body").on('click', "#deleteme", function(e) {
//stuff here
});
How do I make it so that when I click #deleteme
the click event for #clickme
does not run?
Upvotes: 1
Views: 378
Reputation: 77482
Use stopPropagation
$("body").on('click', "#deleteme", function(e) {
e.stopPropagation();
});
Upvotes: 3