Is there a way to access a child target in a parent/ancestor event handler?
I am trying to figure out if its possible to access a child target element from a parent event handler once the opportunity to handle the event has passed on the child element. For instance, if I had the following markup:
I want to be able to access the <a> element that triggered the original click event. But instead of passing a separate function to each jQuery .click() method for "each" <a> I simply want to allow all 3 <a> event handlers to bubble up to the parent <div id="content"> and find out which <a> was clicked from the parent event handler and handle any of the 3 <a> click events from the 1 parent event handler. How would I do this...do I use the Event parameter to find this reference?
<a id="link1" href="#">Link to table of contents</a>
<a id="link2" href="#">Link to chapters</a>
<a id="link3" href="#">Link to appendix</a>
$content = $('#content');
// how can I find the innermost target which triggered the click event?
Thanks for reading