12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- // 숫자 가능
- $(document).on('keyup', '.fnNumeric', function(e) {
- if(e.keyCode == 8 || e.keyCode == 9 || e.keyCode == 37 || e.keyCode == 39 || e.keyCode == 46 ) return;
- re = /[^0-9]/gi;
- if(re.test($(this).val())) $(this).val($(this).val().replace(re,""));
- });
- // 숫자 + . 가능
- $(document).on('keyup', '.fnNumericDot', function(e) {
- if(e.keyCode == 8 || e.keyCode == 9 || e.keyCode == 37 || e.keyCode == 39 || e.keyCode == 46 ) return;
- re = /[^.0-9]/gi;
- if(re.test($(this).val())) $(this).val($(this).val().replace(re,""));
- });
- // 특수문자 제거 개요 : 입력받은 String을 정규식(match)에 맞는 규칙으로 replaceAll 후 String 반환한다. 입력값 : string
- function itp_fn_remove_special_char(str) {
- var match = /[^\u3131-\u314e\u314f-\u3163\u2E80-\u2EFF\u3040-\u309F?\u30A0-\u30FF\u30F0-\u31FF\u3200-\u32FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7A3xfe0-9a-zA-Z\\+\\&\\%\\.\\_\\(\\)\\/\\s\ \u007E]/gi;
- str = str.replace(match, "");
- str = str.replace(/[\r\n]/gi, "");
- str = str.replace(/\t/gi, " ");
- return str;
- }
- // 문자 유니코드를 이용한 Byte 길이 구하기
- function itp_fn_get_byte_length(s,b,i,c){
- for(b=i=0;c=s.charCodeAt(i++);b+=c>>11?3:c>>7?2:1);
- return b;
- }
- // 사업자번호 입력
- $(document).on('keyup', '.fnBizNo', function(e) {
- $(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/([0-9]{3}|[0-9]{2})([0-9]+)?([0-9]{5})$/,"$1-$2-$3").replace("--", "-") );
- });
- // 휴대폰번호 입력
- $(document).on('keyup', '.fnCellNo', function(e) {
- $(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") );
- });
-
- // 주민번호,법인번호 입력
- $(document).on('keyup', '.fnJuminNo', function(e) {
- if($(this).val().length > 6) {
- $(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/([0-9]{6})?([0-9]+)$/,"$1-$2").replace("--", "-") );
- }
- });
|