เหตุการณ์ onreset จะมีประโยชน์เมื่อมีการรีเซ็ตแบบฟอร์ม คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีใช้งาน onreset เหตุการณ์ใน JavaScript -
ตัวอย่าง
<!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>