Horje
HTML onreset Attribute

Definition and Usage

The onreset attribute fires when a form is reset.


Applies to

The onreset attribute is part of the Event Attributes, and can be used on the following element:

Elements Event
<form> onreset

Browser Support


How to Execute a JavaScript when the Reset button in a form is clicked - HTML onreset Attribute

When you reset the form, a function is triggered which alerts some text.
index.html
Example: HTML
<!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>

Output should be:

How to Execute a JavaScript when the Reset button in a form is clicked - HTML onreset Attribute




html onreset attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference