Every line of 'jquery validate only numbers' 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.
35 validate(element) { 36 let val = null; 37 let {min, max, nan, float} = this.settings; 38 39 if (float) { 40 val = parseFloat(element.value); 41 } else { 42 if (element.value.indexOf('.') != -1) { 43 return false; 44 } else { 45 val = parseInt(element.value, 10); 46 } 47 } 48 49 if (isNaN(val) && !nan) { 50 return false; 51 } else if (isNaN(val) && nan) { 52 return true; 53 } 54 55 return (min == null || val >= min) && (max == null || val <= max); 56 }
135 function validateNum(value){ 136 if(/^\d{4,11}$/.test(value)){ 137 return true; 138 }else{ 139 return false; 140 } 141 }
809 static validateNumber (val) { 810 return Number(val); 811 }
72 , Integer : function _fnValidInteger(obj) { 73 var elValue = $(obj).val(); 74 var isValid = ( (elValue.length===0) || (/^-?\d+$/.test(elValue)) ); 75 return isValid; 76 //return spa['_validate']._showValidateMsg(obj, msg, isValid); 77 }
62 function isNumber(value) { 63 var patrn = /^(-)?\d+(\.\d+)?$/; 64 if (patrn.exec(value) == null || value == "") { 65 return false 66 } else { 67 return true 68 } 69 }
84 export function isValid(value: any): boolean { 85 const parsed = parseInt(value); 86 87 return isFinite(parsed) && value >= 0; 88 }
60 function positiveIntegerValidator($elt) { 61 let value = $elt.val().trim().replace(/^0+(.+)/, '$1'); 62 $elt.val(value); 63 if (!value) { 64 return; 65 } 66 if (/^[0-9]+$/.test(value)) { 67 // Check that we are in the positive range of a golang int64 max value, which is 68 // 9223372036854775807 minus a safety marge due to comparison rounding errors. 69 if (parseInt(value) > 9000000000000000000) { 70 return {msg: "Value out of bound."}; 71 } 72 } else { 73 return {msg: "Value must be a positive integer."}; 74 } 75 }
135 function validate(value){ 136 var hours, minutes; 137 138 if(value.length == 1) 139 value="0"+value+"00"; 140 if(value.length == 2) 141 value=value+"00"; 142 if(value.length == 3) 143 value="0"+value; 144 145 hours = value.substring(0,2); 146 minutes = value.substring(2,4); 147 148 if(hours<=23 && minutes<=59){ 149 return value; 150 }else{ 151 return false; 152 } 153 154 155 }
13 public isNumber(value: any) { 14 return typeof value === 'number' && isFinite(value); 15 }
8 function validateNumber(num) { 9 num = (num + '').replace(/\s+|-/g, ''); 10 11 if (!/^\d+$/.test(num)) { 12 return false; 13 } 14 15 var card = cardFromNumber(num); 16 17 if (card) { 18 var cardNumbers = A(card.length); 19 20 return ( cardNumbers.includes(num.length)) && (card.luhn === false || luhnCheck(num)); 21 } 22 23 return false; 24 }