chenge text of a html button in js code example
Example 1: 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>
Example 2: access text inside a button from js
document.getElementById("myButton2").childNodes[0].nodeValue=
"New Button Text using childNodes";