Jquery: Validate the mobile number field.
Hi,
Below is the very simple code which is capable to validate the mobile number field on any .net form.
jQuery(document).ready(function () {
jQuery("#btnChangeNumber").click(function () {
var mobileNo = jQuery("#txtNewMobileNumber").val();
if (mobileNo == "") {
alert('Please enter mobile number.');
return false;
}
else {
var rege = /^[0-9\+\-\(\)\s]*$/;
if (!rege.test(mobileNo)) {
alert('Please enter valid mobile number.');
return false;
}
}
});
});
Enjoy :) !!!!
Below is the very simple code which is capable to validate the mobile number field on any .net form.
jQuery(document).ready(function () {
jQuery("#btnChangeNumber").click(function () {
var mobileNo = jQuery("#txtNewMobileNumber").val();
if (mobileNo == "") {
alert('Please enter mobile number.');
return false;
}
else {
var rege = /^[0-9\+\-\(\)\s]*$/;
if (!rege.test(mobileNo)) {
alert('Please enter valid mobile number.');
return false;
}
}
});
});
Enjoy :) !!!!
Comments
Post a Comment