<form id="myForm"> 전화번호 : <input type="text" id="phone" size=10> <input type="submit" value="submit"> </form> <script> $("#myForm").submit(function(event) { var inputtedPhoneNumber = $("#phone").val(); // 입력 값이 000-0000-0000 형식인지 확인한다. var phoneNumberRegex = /^[0-9]{3}-[0-9]{4}-[0-9]{4}$/; if(!phoneNumberRegex.test(inputtedPhoneNumber)) { alert("Invalid failure"); return false; } else { alert("Invalid check pass"); return true; } }); </script>
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
전화번호 확인
Recent Posts
Archive Posts
Tags