Khi form bị reset, thuộc tính onreset kích hoạt. Bạn có thể chạy mã sau để triển khai thuộc tính onreset:
Ví dụ
<!DOCTYPE html>
<html>
<body>
<form onreset="display()">
Tên sinh viên:<br>
<input type="text" name="sname">
<br>
Môn học:<br>
<input type="text" name="ssubject">
<br>
<input type="reset" value="reset">
</form>
<script>
function display() {
alert("Form reset thành công!");
}
</script>
</body>
</html>