how to change the text of the button with 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: html get button text
ar all = document.getElementsByTagName('*');
for (var i=0, max=all.length; i < max; i++)
{
var elem = all[i];
if(elem.getAttribute("id") == 'ext-gen26'){
if(elem.attributes != null){
for (var x = 0; x < elem.attributes.length; x++) {
var attrib = elem.attributes[x];
alert(attrib.name + " = " + attrib.value);
}
}
}
};