I have 2 elements nested called blanket and blanket-content and I want to recognize the clicks done to the parent alone.
<div id="blanket">
<div id="blanket-content"></div>
</div>
The issue that I'm having is that when I'm clicking the child it is triggering the parent on click. I've tried different methods yet I was unsuccessful. I have tried these to play around with my code;
$('#blanket').on('click', function(ev) {
alert(ev.currentTarget.id); //
});
^ This triggers the click on div as normal and state the parent id even when the child is clicked.
$('#blanket-content').on('click', function(ev) {
alert(ev.currentTarget.id);
});
^ This doesn't trigger anything
What I want to achieve is when I click on blanket-content nothing will happen, but when I click on blanket I want to do something.