Sometimes we need to change the label of a button on click event. Suppose you have button label as "Start" and you want to change that to "Stop" upon clicking start button.
Example: In the below example I've created a function in which I'm changing label of button.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Demo</title>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<button id="startButton" onClick="checkElement(this);">Start</button>
<script>
function checkElement (e) {
if (e.innerHTML == "Start")
{
e.innerHTML = "Stop";
}
else
{
e.innerHTML = "Start" ;
}
}
</script>
</body>
</html>
Hope this will help you :)
0 Comment(s)