We are trying to prevent users from entering text beyond the maximum characters that our database allows us to use text field fields in our web application. Once they have reached the maximum length allowed in the text area, we would still like them to hit keys that are not printed, for example: Tab, backspace, ctrl + s, etc.
I am wondering if there is an easy way to determine if the keyboard code is a printable character. I thought something like String.fromCharCode might do the trick and return false if it can't perform the conversion, but doesn't seem to behave like that.
Ben5e source share