Is it possible with jQuery to discover when a user has entered the first character in a search box as @ or # and then prompt an alert no matter what keyboard language or settings they have?
for instance, if I enter @ into the searchbox I want it to prompt a message or perform my action.
<input type='text' name='search' id='search' />
jQuery
$("#search").keydown(function(event) {
alert(event.which);
});
Only the
keypressevent reports a reliable value forevent.which: http://jsfiddle.net/QDCvG/String.fromCharCode(event.which)can be used to get the typed character.