We are doing logging, we have a header of the website where we are logging anytime it is clicked. We have elements within the element that need logging as well. Is there a way to only log the child elements when clicked within the header by using jquery .not()
function or anything?
HTML
<div id="header">
<div><a class="box blue" href="#">Blue</a></div>
<div><a class="box red" href="#">Red</a></div>
<div><a class="box green" href="#">Green</a></div>
</div>
CSS
$('#header').on('click', function()
alert('header')
});
$('.box').on('click', function() {
alert($(this).attr('class'));
});