/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('#selector').keydown(function(event) { if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode > 112 ) { } else { if (event.keyCode < 95) { if (event.keyCode < 49 || event.keyCode > 57 ) { event.preventDefault(); } } else { if (event.keyCode < 97 || event.keyCode > 105 ) { event.preventDefault(); } } } });