This is my jQuery code
$(document).ready(function () {
$('#txtLoadCode').keydown(function (key) {
if ($(this).val().substring(0, 1) == '0') {
$(this).val('');
return false;
} else {
var keycode = (key.which) ? key.which : key.keyCode;
var code = document.getElementById('<%=txtLoadCode.ClientID%>').value;
if ((!(keycode == 8 || keycode == 46)) && (keycode < 48 || keycode > 57)) {
return false;
} else {
//Condition to check textbox contains ten numbers or not
if (code.length < 5 || keycode == 8) {
return true;
} else {
return false;
}
}
}
});
});
This helps me to accept a 5 digit number. But when I enter only 0, it still accepts that. I want to avoid that.
Please help