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.


<elementName onreset="script">

Supported Tags


Browser compatibility

onreset Yes Yes Yes Yes Yes


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

function myFunction() {
    console.log("The form was reset");


Click to view the demo