With this I can write only numbers:
validaHoraNumero: function(iContTabla,iContFila){
var self = this;
$("#hora_"+iContTabla+"_"+iContFila+"_id").keydown(function (e) {
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || $(this).val().indexOf('.') != -1 || (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || (e.keyCode >= 35 && e.keyCode <= 40)) {
return;
}
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
},
I need to modify this method to not allow write a decimal point "."
How can I do this? thanks.
Just remove the 190, which is '.'
https://jsfiddle.net/s3xqtdax/
You can also check this solution:
How to allow only numeric (0-9) in HTML inputbox using jQuery?