What I want to do is be able to change the text inside of a button by making the text inside an actual variable.
Something like this:
<button type=button>status</button>
but instead of a string, it's a variable:
var status = 'on';
If you're trying to assign the text of a button to a variable then it's as simple as following:
var buttonText = "click me!";
document.getElementById("id-of-your-button").innerHTML = buttonText;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With