Javascript examples for DOM Event:onreset
Using the reset() method of the HTML DOM Form Object to reset the form. When this happens, the onreset event fires, which will trigger an alert function.
<!DOCTYPE html> <html> <body> <form id="myForm" onreset="myAlertFunction()"> First name: <input type="text" name="fname"> <input type="button" onclick="myResetFunction()" value="Reset form"> </form>// www .j av a2 s .c o m <script> function myResetFunction() { document.getElementById("myForm").reset(); } function myAlertFunction() { console.log("The form was reset"); } </script> </body> </html>