Javascript DOM HTML Input Submit value Property set

Introduction

Change the text displayed on a Submit button:

document.getElementById("mySubmit").value = "newSubmitButtonValue";

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="submit" id="mySubmit" value="Submit form">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from w  w w  . j  a  v  a 2  s  . c  o  m*/
  document.getElementById("mySubmit").value = "newSubmitButtonValue";
}
</script>

</body>
</html>

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

The value attribute defines the text displayed on the submit button.

The value property accepts and returns a String type value.




PreviousNext

Related