jQuery: Capturing key events

Target paragraph


The jQuery Code START
    
   <script src="http://code.jquery.com/jquery-latest.js"></script>
   <script type="text/javascript">
      $(function() {
          $('#target').bind('keyup', typer);
      });

      function typer(event) {
          $('#p1').text('Character: ' + String.fromCharCode(event.keyCode));
      }
    </script>
    
    <style type="text/CSS">
        <!--
        .code { color: red; }
        .back { background-color: yellow; }
        -->
   </style>
  </head>

  <body id="target">
    <h1>jQuery: Capturing key events</h1>
    <p id="p1"></p>
    <br />