Answers for "javascript onclick="

47

javascript onclick

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

button onclick

<p id="demo" onclick="myFunction()">Click me to change my text color.</p>

 
<script>
function myFunction() {
  document.getElementById("demo").style.color = "yellow";
}
</script>
Posted by: Guest on August-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language