title: Changing the keypress
body: <p>In an input box or contenteditable=true div, how can I modify a keypress for the letter "a" to return a keybress for the letter "b"? I.e., every time you type the letter "a" in the div, the output is actually the letter "b".</p>
  
  <p>I'm not that concerned with a solution that works in IE--just one that works in Safari, Chrome, &amp; FF.</p>
  
  <p>In Chrome, I can see that a keypress event has the properties "charCode", "keyCode", and "which", all of which get assigned the keypress event number. If I fire an event on a keypress, I can modify these values, but I can't figure out what to return so that the actual key that gets typed is different. For example:</p>
  
  <pre><code>$(window).keypress(function(e){  //$(window) is a jQuery object
      e.charCode = 102;
      e.which = 102;
      e.keyCode = 102;
      console.log(e);
      return e;
  });
  </code></pre>
  
  <p>I can also see that along with charCode, which, and keyCode, there is also an "originalEvent" property which in turn also has these properties. However, I haven't been able to modify those (I tried with things like e.originalEvent.charCode = 102).</p>