|
|
The HTML
onreset event attribute is an event handler that is triggered when an HTML form is reset. This event occurs when a user clicks a reset button within the form, or when the reset() method is called programmatically on the form element.
|
<form onreset="myFunction()">
Enter name: <input type="text">
<input type="reset">
</form>
The onreset attribute fires when a form is reset.
onreset event attribute in HTML is used to execute a script or function when a form is reset. This event fires whenever a user clicks a reset button within a form, or when the reset() method is programmatically called on a form element.
<element onreset="script">
| Value | Description |
|---|---|
| script | The script to be run on onreset |
| Supported HTML tags: | <form> |
|---|
When you reset the form, a function is triggered which alerts some text.
<!DOCTYPE html>
<html>
<body>
<p>When you reset the form, a function is triggered which alerts some text.</p>
<form onreset="myFunction()">
Enter name: <input type="text">
<input type="reset">
</form>
<script>
function myFunction() {
alert("The form was reset");
}
</script>
</body>
</html>
| html event attributes |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Form Events Attribute |
Uploaded by: | Admin |
Read Articlehttps://develop.horje.com/learn/1434/reference