/ Published in: jQuery
Avoid history back when is pressed backspace key in number imput
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('input[type=number]').on('keydown', function(e) { var key = e.which || e.keyCode || e.charCode; if (key === 8) { var s = $(this).val(); s = s.substring(0, s.length - 1); $(this).val(s); return false; } });