Execute a JavaScript when a form is reset: - Javascript DOM Event

Javascript examples for DOM Event:onreset

Description

Execute a JavaScript when a form is reset:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form onreset="myFunction()">
  Enter name: <input type="text">
  <input type="reset">
</form>//from w w  w.j  a  v a 2s.c om

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

</body>
</html>

Related Tutorials