숫자와 특수문자 . – 만 가능
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!DOCTYPE html> <html lang="ko"> <meta charset="utf-8"> <body> <script> function validHP(resData, i) { var regex = /^0(\d{1,2})[.-]?(\d{3,4})[.-]?(\d{4})$/; if (!regex.test(resData)) { alert("핸드폰(형식:0102223333) 정확히 입력해 주세요."); //jQuery("#" + focus).focus(); return false; } return true; } </script> <button onclick="validHP('032.31234',1)"> Try it</button> 032.31234 </body> </html> |