&nbs"/> &nbs">

Home  >  Article  >  Web Front-end  >  Execute script when reset button in form is clicked in HTML?

Execute script when reset button in form is clicked in HTML?

王林
王林forward
2023-08-22 13:41:05861browse

Execute script when reset button in form is clicked in HTML?

When the form is reset, the onreset attribute will trigger. You can try running the following code to implement the onreset property −

Example

<!DOCTYPE html>
<html>
   <body>
      <form onreset = "display()">
         Student Name:<br>
         <input type = "text" name = "sname">
         <br>
         Student Subject:<br>
         <input type = "text" name = "ssubject">
         <br>
         <input type = "reset" value = "reset">
      </form>
      <script>
         function display() {
            alert("Form reset successfull!");
         }
      </script>
   </body>
</html>

The above is the detailed content of Execute script when reset button in form is clicked in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete