title: Detect entered character with JavaScript
body: <p>I'd like to start an action (enabling autocomplete) when user types '@'. I have jQuery available.</p>
  
  <p>Usually on a QWERTY keyboard, it is like this:</p>
  
  <pre><code>$('textarea').live('keydown', function(e) {
    if (e.which === 50) {
      console.log('@ has been entered.');
    }
  });
  </code></pre>
  
  <p>However it does not work correctly on an AZERTY keyboard. The keyCode = 50 corresponds to the <kbd>é</kbd><kbd>~</kbd><kbd>/</kbd><kbd>2</kbd> key. To type '@' in AZERTY keyboard, it is <kbd>AltGr</kbd> + <kbd>à</kbd><kbd>@</kbd><kbd>/</kbd><kbd>0</kbd> key.</p>
  
  <p>Edit: Autocomplete starts when @ is entered, and only after that. Example, when someone enters "Hello @" then it starts, however when he types "Hello @nothing else" the complete won't do anything. Example: <a href="http://mrkipling.github.com/jQuery-at-username/" rel="nofollow noreferrer">http://mrkipling.github.com/jQuery-at-username/</a> (it works only on QWERTY keyboard).</p>