revision:
The onreset event occurs when a form is reset.
Supported HTML tags: <form>
<element onreset="script"></element>
script: this attribute contains a "single value script", which works when the onreset event attribute is called.
When you reset the form, a function is triggered which alerts some text.
<p class="spec">When you reset the form, a function is triggered which alerts some text.</p> <form style="margin-left:3vw;" onreset="resetFunction()"> <p class="spec">Enter name: <input type="text"></p> <input type="reset"> </form> <script> function resetFunction() { alert("The form was reset"); } </script>
When you reset the form, a function is triggered which outputs some text.
<p class="spec">When you reset the form, a function is triggered which outputs some text.</p> <form style="margin-left:3vw;" onreset="formReset()"> <p class="spec">enter name: <input type="text"></p> <input type="reset"> </form> <p class="spec" id="demo"></p> <script> function formReset() { document.getElementById("demo").innerHTML = "The form was reset"; } </script>