How do I define and pass a value to a script tag from the html file?
for example to do something like below where I want to pass the value of "myparameter"
<script src="app.js" myparameter="myvalue" type="module"></script>
How do I define and pass a value to a script tag from the html file?
for example to do something like below where I want to pass the value of "myparameter"
<script src="app.js" myparameter="myvalue" type="module"></script>
If you have your html like this:
<script src="app.js" myparameter="myvalue" type="module"></script>
Inside js script:
document.currentScript.getAttribute('myparameter'); //myvalue