When user type text a, b, c is ok.
If user type another text like 0, 9, z, x.... alert('can't type this word');
How to make it easily ?
When user type text a, b, c is ok.
If user type another text like 0, 9, z, x.... alert('can't type this word');
How to make it easily ?
Do something like this:
$(document).ready(function() {
$("#yourInputId").keyup(function() {
if($(this).val() == "z") {
alert("You cant type this");
}
});
});
if( $(this).val().match(/[^abc]/) ) {alert("unallowed characters");}This is the link to allow Number and not alphabets (check the code here and make changes)....
Help your self finding out the key code for whichever alphabet you need to allow...
Here is the keycode
You can try use regular expression. example: http://www.9lessons.info/2010/01/jquery-validation-with-regular.html
or setup a powerful plugin like: http://bassistance.de/jquery-plugins/jquery-plugin-validation/