onreset Event
Complete Event Object Reference
Definition and Usage
The onreset event occurs when the reset button in a form is clicked.
Syntax
onreset="SomeJavaScriptCode"
|
Parameter |
Description |
SomeJavaScriptCode |
Required. Specifies a JavaScript to be executed when the
event occurs. |
Supported by the following HTML tags:
Supported by the following JavaScript objects:
Example
In this example the form changes back to the default values and displays an
alert box when the reset button is clicked:
<form onreset="alert('The form will be reset')">
Firstname: <input type="text" name="fname" value="John" />
<br />
Lastname: <input type="text" name="lname" />
<br /><br />
<input type="reset" value="Reset">
</form>
|
The output of the code above will be:
Try-It-Yourself Demos
onreset
How to use onreset to display an alert when a reset event occurs.
Complete Event Object Reference
…
|