I have a bootstrap button which displays "Show User Information" as the button lable. When user click on the button, i want to change the label to "Display Only Users" and again when user click on "Display Only Users" it has to change the button label to "Show User Information".
<button class="btn btn-primary" type="button" onclick="myFunction()" id="myButton1">Show User Information</button>
js code:
function myFunction() {
var elem = document.getElementById("myButton1");
if (elem=="Show User Information") elem.value = "Display Only Users";
else elem.value = "Show User Information";
}
The above js code is not changing the button label when clicked. Any inputs?