How can I access element's attribute or name in 'onload' function ?
<script src="bla/bla/bla.js" data-name="blabla" onload="console.log("loaded script with name ... ")"></script>
Within the code contained in the text of the
this refers to the element. So
this.getAttribute("data-name") will give you the attribute value.
But I would steer you away from using