<script data-src="scripts/" src="scripts/myscript.js"></script>
from within myscript.js how do i retrieve data-src? assume that there are also a lot of scripts loaded in the same format as this and that myscript.js does not know anything besides the fact that it’s going to get the attribute data-src
is this possible?
You could do it like this because your script will be the last
scriptelement found bygetElementsByTagName(), until the nextscriptis loaded when that one will become the last and so on.