You are here: Reference > JavaScript > client-side > event handling > methods > reset (form)

reset method (form)

Browser support:
Restores the contents of the elements contained by the current form to its original value.
A call to the reset method fires the onreset event. This method has the same effect as clicking on a reset button of the current form. The reset method is useful if you need a custom reset button.


object.reset ( );
You can find the related objects in the Supported by objects section below.

Return value:

This method has no return value.

Example HTML code 1:

This example illustrates the use of the reset method:
    <script type="text/javascript">
        function Reset (form) {
            form.reset ();
        Change the value of this input field:
        <input type="text" value="Original value"><br /><br />
        Same effect : 
        <button onclick="Reset (form);">Reset the form!</button>
        <input type="reset" />
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content