title: JavaScript: how to get content of an attribute of a tag
body: <p>When I run this:</p>
  <pre class="lang-js prettyprint-override"><code>document.activeElement
  </code></pre>
  <p>I get this:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;span id=&quot;123&quot; data-caption=&quot;ABC&quot;&gt;
  </code></pre>
  <p>How to get the content of the <code>data-caption</code> tag?
  In this case, I would like to see the string <code>ABC</code>.</p>
  <p>Many thanks.</p>