Get Input Reset Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Reset

Introduction

The Input Reset object represents an HTML <input> element with type="reset".

You can access an <input> element with type="reset" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="myFunction()">get the text displayed on the reset button</button>

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

<script>
function myFunction() {//  ww  w  . ja  va2s  .c om
    var x = document.getElementById("myReset").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials