How to prevent typing decimals in input type number
If you have problem with cutting decimal point from input with type number, you can just define KeyDown event on the input element:
var input_element = document.getElementById('number-input'); input_element.addEventListener('keydown',function(event) { if(event.keyCode == '190') { event.preventDefault(); } });
That’s it!