#108970

Hi,

You can prevent the addition of chars that are not Numbers this way:
const input = document.querySelector(“#integer-input”);

input.addEventListener(‘keydown’, function (event) {
if(isNaN(event.key) && event.key != ‘Backspace’) {
event.preventDefault()
}
})

This way, the user will not be able to add , or .

Best Regards,
Svetoslav Borislavov

Smart UI Team
https://www.htmlelements.com/