Javascript DOM HTML Input Reset value Property set

Introduction

Change the text displayed on a Reset button:

document.getElementById("myReset").value = "newResetButtonValue";

Click the button to change the text displayed on the Reset button.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="reset" id="myReset" value="Reset form">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/* w  ww  .j  ava2  s.  c  om*/
  document.getElementById("myReset").value = "newResetButtonValue";
}
</script>

</body>
</html>

The value property sets or gets the value attribute of the reset button.

The value attribute defines the text that is displayed on the reset button.

The value property accepts and returns a boolean type value.




PreviousNext

Related