How can I detect clicked element in code like this:
HTML:
<div class="foo">
<a href=""><b>Foo</b></a>
</div>
<div class="bar">
<a href=""><b>Bar</b></a>
</div>
jQuery:
$('body').on('click', '.foo, .bar', function (e) {
if (detectElement == '.bar') {
//
}
}
I try $('this') but returned body not clicked element.
I try also e.target but I want get main element (.foo or .bar), not <a> / <b>