I am trying to disable all other characters from being entered in text input.
Since to get the $ you have to press the shift-key and the
Then DONT use this way to solve your problem: since you cannot predict that every keyboard-layout will always have $-sign entered as shift+4.
You can still get keycode 4, and check if shift was pressed, but you could not be sure of this!!
Thus it would be better to simply replace all illegal characters in your fields (before you submit the data). Think: str.replace()
You could also check for your set of illegal characters on the onkeyup event of the input-box, effectively replacing all illegal characters as you type!
Like: onkeyup="this.value.replace(/[your illegal characters]/gi, '')"
That should do what you want.
Please note: you should NEVER trust browser-input, and should still filter this input in your receiving script!!!
Good Luck!!