<input type='text' value='1' name='iNum' class='Line' οnkeyup='setNum(this)'/>
function setNum(obj) {
obj.value = obj.value.replace(/[^\d]/g, '')
}
app端:
<input type= "text" id= "iNum" value= "' + item.iNum() + '" class="modal-text-input col-40" style= "width: 80px;text-align: center;" οnfοcus= "this.select()" />
$("#iNum").on('keyup', function () {
if (!$(this).val().match(/^\d*$/)) {
$(this).val(0);
}
});