Javascript DOM HTML Input Reset value Property get

Introduction

Get the text displayed on a Reset button:

var x = document.getElementById("myReset").value;

Click the button to display 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>

<p id="demo"></p>

<script>
function myFunction() {/*w ww.j  a va2 s . c  o  m*/
  var x = document.getElementById("myReset").value;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related