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
There is no key code for $, since it's not a valid key - it has to be accessed via some kind of shifter.
Usually, you would perform a check to see if the shifter was active, and the listen out for the keypress event on the relevant key. Something like this for a QWERTY layout in your instance:
var shiftPressed = false;
$(window).keydown(function(e) {
if(e.which == 16) { shiftPressed = true; }
if(e.which == 52 && shiftPressed)
{
// Do whatever here...
}
});
$(window).keyup(function(e) {
if(e.which == 16) { shiftPressed = false; }
});