Phone Number Validate JQuery
This script will check following thing in Phone
- Phone is not String
- Phone number must not starting with 0 or 1
jQuery('#phone').keyup(function (e)
{
var phonevalidate = jQuery('#phone').val();
var checkfirstval = phonevalidate.charAt(0);
if(checkfirstval==0 || checkfirstval==1){
jQuery('#phone').val('');
}
var regEx=/[^0-9]/;
var checkstring = regEx.test(phonevalidate);
if(checkstring){
jQuery('#phone').val('');
}
});
Note: Here input id is phone.