Javascript Form How to - Get Reset Button value








Question

We would like to know how to get Reset Button value.

Answer


<!--from w  w  w . j a v  a  2s  . c om-->
<html>
<body>
    <form name="form1">
        Enter Name: <input type="text" Name="name" Size=15>
        <br>
        Enter Phone: <input type="text" Name="phone" Size=10>
        <br><br>
        <input type="reset" name=resetbutton value=Reset
           onClick='console.log("The button value is: " + document.form1.resetbutton.value)'>
    </form>
</body>
</html>

The code above is rendered as follows: