Tag: html

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 ”;
}));
});
});