Issue: My HTML text input has a script that restricts input to alphanumeric characters in the onpress, onkeydown, and onkeyup events:
this.value = this.value.replace(/[^a-zA-Z0-9]/, '')
While this validation ensures only alphanumeric characters can be entered, it also prevents normal cursor movement using keys like home, end, or arrow keys. Cursor adjustment is limited to using the backspace key, which may not always be ideal.
I am curious about why this behavior occurs specifically in Firefox and Chrome (I have not tested it in IE yet). My assumption is that it could be related to the this.value =
part of the code, as regular expressions typically do not handle arrow key functionality.