Advertisement
Home Open Editor ❯

HTML onreset Attribute

Example

<form onreset="myFunction()">
  Enter name: <input type="text">
  <input type="reset">
</form>

<script>
function myFunction() {
  alert("The form has been reset");
}
</script>

Try this code ❯

Meaning

The onreset attribute specifies that the form is being reset, possibly by the click of a reset button.


Standard Syntax

<element onreset="script">


Applies to:

The onreset attribute can be used on the following element:

Element Attribute
<form> onreset

Advertisement

Attribute Values

Value Description
script Specifies the script to be run on onreset.
Home Open Editor ❯
Advertisement