I\'m trying to write a regex to verify that an input is a pure, positive whole number (up to 10 digits, but I\'m applying that logic elsewhere).
Right now, this is t
You can do this way:
/^[0-9]{1,10}$/
var tempVal = $('#targetMe').val(); if (/^[0-9]{1,10}$/.test(+tempVal)) // OR if (/^[0-9]{1,10}$/.test(+tempVal) && tempVal.length<=10) alert('we cool'); else alert('we not');
Refer LIVE DEMO