JavaScript 폼 유효성검사

1 개요[ | ]

JavaScript Form Validation
JavaScript 폼 유효성검사

2 예시[ | ]

<h2>배송조회</h2>
<form name='my_form' method='post' onsubmit='return validateForm()'>
운송장번호: <input type='text' name='invoice_number' />
<button>조회</button>
</form>

<script>
function validateForm() {
    var invoice_number = document.forms['my_form']["invoice_number"].value;
    if ( invoice_number == null || invoice_number == "") {
        alert("운송장번호를 입력해주세요.");
        return false;
    }
}
</script>

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}