I'm trying to make it impossible (well, sure, you could turn off js, but anyway) to type in anything but numbers in an input.
I started with on keyup removing anything that is not 0-9, and that worked, but the problem is that the letter you type in shows for a milisecond or so, and I don't want that.
So I tried to prevent the default action, so nothing would be entered in the input unless I say so, using the event object to detect which key was pressed and then inserting it into the input if it was 0-9. Also worked, but it breaks if I were to press the arrows to add a number in the beginning, because I just append the number at the end of the input value.
Is there a way to do this?