// Allow only alphabet keys in textfiled
$(document).ready(function () {
$("#inputTextBox").keypress(function (event) {
var inputValue = event.which;
//if digits or not a space then don't let keypress work.
if ((inputValue > 64 && inputValue < 91) // uppercase
||
(inputValue > 96 && inputValue < 123) // lowercase
||
inputValue == 32) { // space
return;
}
event.preventDefault();
});
});
// Allow only numerics in text field
$(document).ready(function () {
$("#inputTextBox").keypress(function (event) {
var charCode = (event.which) ? event.which : event.keyCode
if(charCode==8)//back space
return true;
if (charCode < 48 || charCode > 57)//0-9
{
//alert("Please Enter Only Numbers.");
return false;
}
return true;
});
});
$(document).ready(function () {
$("#inputTextBox").keypress(function (event) {
var inputValue = event.which;
//if digits or not a space then don't let keypress work.
if ((inputValue > 64 && inputValue < 91) // uppercase
||
(inputValue > 96 && inputValue < 123) // lowercase
||
inputValue == 32) { // space
return;
}
event.preventDefault();
});
});
// Allow only numerics in text field
$(document).ready(function () {
$("#inputTextBox").keypress(function (event) {
var charCode = (event.which) ? event.which : event.keyCode
if(charCode==8)//back space
return true;
if (charCode < 48 || charCode > 57)//0-9
{
//alert("Please Enter Only Numbers.");
return false;
}
return true;
});
});
No comments:
Post a Comment