JavaScript-from-Beginner-to.../chapter10/ch10-specifyingevents.html
2021-09-04 21:22:51 +02:00

14 lines
376 B
HTML
Executable File

<html>
<body>
<p id="unique" onclick="magic()">Click here for magic!</p>
<script>
document.getElementById("unique").onclick = function() { magic() };
document.getElementById("unique").addEventListener("click", magic);
document.getElementById("unique").addEventListener("click", function() { magic(arg1, arg2) });
</script>
</body>
</html>