Every line of 'jquery phone number validation with country code' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
123 function InvalidPhone(){ 124 var invalid_phone_number = $("#invalid-phone-number"); 125 invalid_phone_number.attr("attrHidden", "false"); 126 var need_phone_number = $("#need-phone-number"); 127 need_phone_number.attr("attrHidden", "true"); 128 window.phone_ok = false; 129 }
40 function isValidPhone(value) { 41 return /^[0-9]+$/ig.test(value) 42 }
35 function validateZIPCode(value){ 36 if (!isZIPCode(value)) { 37 alert("Please enter a ZIP code in the form xxxxx."); 38 }; 39 }
21 export function isValidLength(phone: string): boolean { 22 return phone.length >= PHONE_MIN_LENGTH && phone.length <= PHONE_MAX_LENGTH; 23 }
269 static phone(value) { 270 var reg = /^((\d{10,11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)$/; 271 return reg.test(value); 272 }
39 function validateZipCode(inputField, helpText) { 40 // First see if the input value contains data 41 if (!validateNonEmpty(inputField, helpText)) 42 return false; 43 44 // Then see if the input value is a ZIP code 45 return validateRegEx(/^\d{5}$/, 46 inputField.value, helpText, 47 "Please enter a 5-digit ZIP code."); 48 }
210 function getPhoneCode(){ 211 return $("#phoneNumber").val(); 212 }
28 export function phoneValidator(rule, value, callback) { 29 const INVALID_PHONE_MSG = 'Número de telefone inválido'; 30 const PHONE_REGEX = /^\([0-9]*\)\s*[0-9]*\s*-*\s*[0-9]*/i; 31 32 if (!rule.required && !value) { 33 callback(); 34 } 35 36 if (PHONE_REGEX.test(value)) { 37 callback(); 38 } else { 39 callback(INVALID_PHONE_MSG); 40 } 41 }
42 public getDigits(phone: string): string { 43 const numbers = phone.match(/\d+/g) 44 if (numbers === null) return '' 45 return numbers.join('') 46 }
22 ngOnInit() { 23 this.validator = phone(this.phone); 24 }