Tag: jquery

validate mobile number on keypress using jquery

How to validate and restrict unwanted character for mobile or phone number field using jquery

$(document).ready(function () {
$(‘#mobile’).keyup(function () {
var $th = $(this);
$th.val($th.val().replace(/[^0-9]/g, function (str) {
return ”;
}));
});
});

validate zipcode pincode on keypress using jquery

How to validate and restrict unwanted character for zipcode or pincode field using jquery

$(document).ready(function () {
$(‘#pincode’).keyup(function () {
var $th = $(this);
$th.val($th.val().replace(/[^0-9]/g, function (str) {
return ”;
}));
});
});

validate name on keypress using jquery

How to validate and restrict unwanted character for name field using jquery

$(document).ready(function () {
$(‘#name’).keyup(function () {
var $th = $(this);
$th.val($th.val().replace(/[^a-zA-Z0-9 \`]/g, function (str) {
return ”;
}));
});
});