I’ve got a problem with a website, when I attach a js function to a button using code
html:
<button id="myid" type="submit">run</button>
js:
document.getElementById("myid").addEventListener("click", myFunction, false);
async function myFunction() {}
it is not working, but when I use
html:
<button id="myid" type="submit" onclick="myFunction()">run</button>
js:
async function myFunction() {}
it is all good. How do I make first code snippet working?
p.s. system windows 10, browser Firefox of latest version