Implement a functionality for a textbox to allow only numbers in jQuery:
$('.only-digits').on('keypress', function (e) {
if ((e.keyCode < 48) || (e.keyCode > 57)) {
return false;
}
});
Remains the problem that you can paste text inside the textboxes. To prevent this behavior:
$('.only-digits').bind("cut copy paste",function(e) {
e.preventDefault();
});