Answers for "how to change the text of the button on click in java script"

2

javascript change button text onclick

<!DOCTYPE html>
<html>
<body>

<button id="demo" onclick="myFunction()">Click me to change my HTML content (innerHTML).</button>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Paragraph changed!";
}
</script>

</body>
</html>
Posted by: Guest on September-14-2020

Code answers related to "how to change the text of the button on click in java script"

Browse Popular Code Answers by Language