onreset event | reset event
Occurs on a form before it is reset.
When a form is reset, all controls within the form are set to their initial values.
The onreset event is cancelable, if it is canceled, the reset operation is not performed.
How to register:
In HTML:
In JavaScript:
<ELEMENT onreset="handler"> |
In JavaScript:
object.onreset = handler; | |||||||||||
object.addEventListener ("reset", handler, useCapture); |
| ||||||||||
object.attachEvent ("onreset", handler); |
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers.
The properties of the event object contain additional information about the current event.
To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript. |
Basic information:
Bubbles | No |
Cancelable | Yes |
Event object | Event |
Actions that invoke the onreset event:
- Clicking on a reset button in a form.
- Invoking the reset method of a form.
Example HTML code 1:
This example illustrates the use of the onreset event:
|
||||
<head> <script type="text/javascript"> function OnReset () { var textField = document.getElementById ("myText"); alert ("The value of the text field before the reset operation:\n" + textField.value); } </script> </head> <body> <form onreset="OnReset ()"> <input type="text" id="myText" size="50" value="Modify this text first, then click on the reset button!" /> <input type="reset" /> </form> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments