Только цифры в input
function onlyInteger(a) {
$(a).bind("change keyup input click", function () {
if (this.value.match(/[^0-9]/g)) {
this.value = this.value.replace(/[^0-9]/g, '');
}
});
}
onlyInteger(".range-control"); // selectr in jquery
//Только цифры можно точку или запятую и два знака после
//only integer in input
function onlyInteger(a) {
$(a).bind("change keyup input click", function (e) {
var reg = /(\d+[\.\,]?\d?\d?)/;
if (this.value.match(reg)) {
this.value = this.value.match(reg)[1];
}
else
this.value = '';
//noinspection JSAnnotator,JSAnnotator
});
}