HTML onreset Attribute

❮ HTML Attributes


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

function myFunction() {
  alert("The form has been reset");


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

Standard Syntax

<element onreset="script">

Browser Support


Applies to:

The onreset attribute can be used on the following element:

Element Attribute
<form> onreset

Attribute Values

Value Description
script Specifies the script to be run on onreset.
❮ HTML Attributes