Computer >> Máy Tính >  >> Lập trình >> Javascript

Việc sử dụng sự kiện onreset trong JavaScript là gì?


Sự kiện thiết lập lại hữu ích khi một biểu mẫu được đặt lại. Bạn có thể thử chạy mã sau để tìm hiểu cách triển khai onreset sự kiện trong JavaScript -

Ví dụ

<!DOCTYPE html>
<html>
   <body>
      <script>
         function resetFunct() {
            alert("The form was reset");
         }
      </script>
      <form onreset = "resetFunct()">
         Enter age: <input type = "number"><br>
         Enter birth month: <input type = "text"><br>
         <input type = "reset">
      </form>
   </body>
</html>