title: Correct way to capture event.target when a child element is clicked
body: <p>I want to call a javascript function when an anchor is clicked and capture the element's href &amp; title attributes. My code works fine if the content of the element is plaintext but when I introduce new elements inside of the anchor tag such as a label &amp; icon then e.target is now the label or icon so I can no longer get the href attribute.</p>
  
  <p>I can write some code that checks the element type and if it's not an anchor find the parent but I'm wondering if there's a better way for my function to get the anchor element from event.target even if a sub element is clicked?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function doStuff(e) {
    console.log(e.target.getAttribute("href"));
    console.log(e.target.getAttribute("title"));
    e.preventDefault();
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a href="/bob" title="Bob" onClick="doStuff(event)"&gt;
    &lt;i class='fa fa-user'&gt;&lt;/i&gt;
    &lt;label&gt;Bob&lt;/label&gt;
  &lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>