에 추가된 필드 값이 유효하지 않은 경우 oninvalid 이벤트가 발생합니다. 사용자가 제출하기 전에 양식을 작성하는 것을 잊은 경우 메시지를 추가하십시오.
예시
다음 코드를 실행하여 무효를 구현하는 방법을 배울 수 있습니다. 자바스크립트의 이벤트
<!DOCTYPE html>
<html>
<body>
<script>
function resetFunct() {
alert("The form was reset");
}
</script>
<form>
Enter Name: <input type="text"
required oninvalid = "alert('Fill the form before submitting!');" > <br>
Enter birth month: <input type= "text"> <br>
<input type = "submit">
<input type = "reset">
</form>
</body>
</html>