Skip to main content
reset method

Simulates a mouse click on a reset button for the calling form.

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5



var retval = form.reset();


This method has no parameters.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information


The reset method raises the onreset event on the form.

The reset method fires the onreset event on the form.


This example demonstrates how to use the reset method for a form object. When the button is pressed, the form is reset, resulting in the onreset event call on the form object. The onreset event calls an event handler which in turn adds the text Resetting form. to the text area below.

Code example:


<script type="text/javascript">
function doReset(){
    oTextArea1.value += "Resetting form.  ";


<div id="oDiv1" style="border: 1px solid black; background: #EEEEEE; padding: 10px;">
  <form name="form1" onreset="doReset();">
	<b>Enter some text:</b> <input name="oText1" type="text" value=""><br/><br/>
	<button onclick="form.reset();">form.reset()</button>
<b>Text area</b><br><textarea id="oTextArea1" cols="75" rows="5" value=""></textarea>



See also