w3resource

HTML onreset attribute

onreset

The purpose of the HTML onreset attribute is reset a form. When a form is reset, all the fields get their initial / default value back.

Supported elements

HTML onreset attribute supports form element.

Syntax

<form onreset="value" >.....</form>

Type of value

Script.

Value

A script which is to be executed.

Default value

There is no default value of HTML onreset attribute.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML onreset attribute with form element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML onreset attribute with form element</title>
</head>
<body>
<form name="user_info" action="action_get.php" method="get"> 
Name : <input type="text" name="name"><br>
email  : <input type="text" name="email"><br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="submit" value="Reset">
</form>
</body>
</html>

Result

html onreset attribute with form element

View this example in a separate browser window

Example of HTML onreset attribute with form element

Previous: HTML onload attribute
Next: HTML onselect attribute

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.