Return to Snippet

Revision: 65212
at November 9, 2013 03:42 by porquero


Initial Code
$('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;
    }
});

Initial URL


Initial Description
Avoid history back when is pressed backspace key in number imput

Initial Title
Avoid history back when is pressed backspace key in number imput

Initial Tags
javascript, number

Initial Language
jQuery