HTML event attribute onreset








The onreset attribute event is triggered when a form is reset.

What's new in HTML5

The onreset attribute is new in HTML5.

Syntax

<elementName onreset="script">

Supported Tags

<form>, 
<keygen>

Browser compatibility

onreset Yes Yes Yes Yes Yes




Example

<!DOCTYPE html>
<html>
<body>
<!--from  w ww  . j  a va  2s  . c o m-->
<form onreset="myFunction()">
  Enter name: <input type="text">
  <input type="reset">
</form>

<script>
function myFunction() {
    console.log("The form was reset");
}
</script>

</body>
</html>

Click to view the demo