I have a simple keypress event that throws an alert when you press "a" or "s". Is it possible to bind this event to specific elements, so that it is not a global keypress, but only fired if the test link is first clicked. Then, $(this) would be used to get attributes of the clicked element if needed.
Any ideas on how to get that to work, or if it is possible? $("#test").keypress(function(e) { switch(e.which) { case 97: alert("A pushed!"); break; // user presses the "s" key case 115: alert("S pushed!") } });