Hi Guys ,
$(document).ready(function() {
$('#textboxid').blur(function(e) {
if (validateMobile('textboxid')) {
alert('valid');
}
else {
alert('invalid');
}
});
});
function validateMobile(txtPhone) {
var a = document.getElementById(txtPhone).value;
var filter = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/;
if (filter.test(a)) {
return true;
}
else {
return false;
}
}
In this post we are going to learn how to validate mobile number by using jquery
Below is the jquery mobile, validation regular expression, mobile validation jquery regular expression which is for checking mobile digit number.
$('#textboxid').blur(function(e) {
if (validateMobile('textboxid')) {
alert('valid');
}
else {
alert('invalid');
}
});
});
function validateMobile(txtPhone) {
var a = document.getElementById(txtPhone).value;
var filter = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/;
if (filter.test(a)) {
return true;
}
else {
return false;
}
}
No comments:
Post a Comment