Ask HN: What is the best way to start autoplay?
1 comments
Both do the same. (2) is more modern syntax as onclick DOM attributes are deprecated.
https://stackoverflow.com/ might be better suited for specific programming language questions.
https://stackoverflow.com/ might be better suited for specific programming language questions.
Thank you, Sir.
1) <body>VS
2) document.addEventListener('click', musicPlay); function musicPlay() { document.getElementById('sound').play(); }
Thank you.