Supposing I have the following javascripts inserted in my HTML code...
<a href="http://example.com" data-example="my example">Example #1</a>
<script src="http://example.com/javascript.js"></script>
<a href="http://example.com" data-example="my example">Example #2</a>
<script src="http://example.com/javascript.js"></script>
<a href="http://example.com" data-example="my example">Example #3</a>
<script src="http://example.com/javascript.js"></script>
How do I get the value of data-example in the 3rd link (Example #3)?
document.querySelectorAll('a')[2].dataset.exampleis one way in pure JSdocument.querySelectorAll('a')[n].dataset.example