Saved X
Google login
SignUp with Email
X

Alphabet only in jquery

theindreshverma ( Edited  Sep 01, 12:15 am )
Login

$('#input').keypress(function (e) {
    var regex = new RegExp("^[a-zA-Z\s]+$");
    var str   = String.fromCharCode(!e.charCode ? e.which : e.charCode);
    if (regex.test(str)) {
        return true;
    }
    else
    {
        e.preventDefault();
        alert('Please Enter Alphabate');
        return false;
    }
});

Sourcecode Tags

More Sourcecodes

More Sourcecodes