Positive integer number check block

Positive integer number check block

$ ( "INPUT [type = 'Number']") keyDown (function (E) {. 
var code = the parseInt (e.keyCode);
IF (code> = 96 && code <= 105 || code> = 48 && code <|| code 57 is == =. 8) {
return to true;
} the else {
return to false;
}
})
// text box input event, any non-integer inputs are reset. 1
$ ( "iNPUT [type = 'Number '] "). the bind (" INPUT propertyChange ", function () {
IF (isNaN (parseFloat ($ (the this) .val ())) || parseFloat ($ (the this) .val ()) <= 0) {
$ (the this) .val (0);
} the else {
$ (the this) .val (the parseInt ($ (the this) .val ()));
}
})
@. Posted 2017-11-18 15:48 small day yy_sina read ( ... ) Comments ( ... ) edit collections
Published 42 original articles · won praise 4 · Views 4624

Guess you like

Origin blog.csdn.net/lucasxt/article/details/90259610