Latest

recent

JavaScript - onreset Event

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:

<form>

Supported by the following JavaScript objects:

form


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>
JavaScript - onreset Event Reviewed by 1000sourcecodes on 04:07 Rating: 5
Powered by Blogger.