Source Code:
(back to article)
Submit
Result:
Report an issue
<button id="myButton">Click me</button> <p id="output">Click the button to see the result.</p> <script> document.getElementById("myButton").addEventListener("click", function () { document.getElementById("output").innerHTML = "This button was clicked: " + this; }); </script>