How do I restrict a keydown event to only take effect when a character is pressed? I'd like to skip the code when a non-character is pressed on the keyboard, e.g. home button, end button.
I know I could target those buttons with e.which == someNumber
but is there a better way to do it? Writing a condition for each non-character button doesn't seem like a good idea.
Thank you!
You have to implement some form of range checking. Pick the range that takes the least amount of coding. What would you characterize as a character? Would it be everything between 32 and 125? Check out the range you're interested in on an ascii table.