Answers for "javascript on click event handler"

46

javascript onclick event listener

document.getElementById("myBtn").addEventListener("click", function() {
  alert("Hello World!");
});
Posted by: Guest on July-10-2020
9

javascript click event

<button onclick="myFunction()">Click me</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>
Posted by: Guest on April-10-2020

Code answers related to "javascript on click event handler"

Browse Popular Code Answers by Language