I have an Input element with type = "number", which is supposed to only accept 0,1,..,9 and "." Per default you can also wrie +, - ans soem other characters which I prevent with EventListener "keydown" and keyCodes. It works fine.
But how can I prevent the user from pasting or drag and dropping some other stuff into the input? I tried to validate input.value but it actually gives me "" when it is not a valid number. Is there a way to see what the user wants to paste, before it is pasted?
I also know, that I could change the type to "text", but at leas for now it is not an option.
Thanks.
min="0"to prevent negative numbers. Sure they can enter in invalid characters but the form will be invalid and prevent a submit