INPUT FIELD VALIDATION- LETTERS OR NUMBER
ALPHA LETTERS ONLY
$(document).on("keydown","input",function(event){
//alert("keydown");
var key = event.keyCode;
return ((key >= 65 && key <= 90) || key == 8);
});
Note that the value of 8 is for the backspace key.
NUMBERS ONLY
$("input").keypress(function(e){
//alert("keydown");
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; }
Post a Comment