title: Javascript: How to read a hand held barcode scanner best?
body: <p>I'd like to be able to scan barcodes via a hand held scanner and handle the results with Javascript.</p>
  
  <p>A barcode-scanner works almost like a keyboard. It outputs the scanned/translated (barcode->number) data raw (right?). Actually I just need to catch the output and proceed. But how?</p>
  
  <p>Here's some pseudocode I'd like to make work:</p>
  
  <pre><code>$(document).on("scanButtonDown", "document", function(e) {
      // get scanned content
      var scannedProductId = this.getScannedContent();
  
      // get product 
      var product = getProductById(scannedProductId);
  
      // add productname to list
      $("#product_list").append("&lt;li&gt;" + product.name + "&lt;/li&gt;");
  });
  </code></pre>
  
  <ul>
  <li>Any ideas (frameworks, plugins, snippets)?</li>
  <li>Any barcode-scanner (hardware) recommendation?</li>
  </ul>
  
  <p>Thanks in advance!</p>
  
  <p><em>I found <a href="https://stackoverflow.com/questions/3435561/reading-from-barcode-scanner">this</a> and <a href="https://stackoverflow.com/questions/10665392/jquery-barcode-scanner-integration">this</a> good questions but I'd like to get more information about the handling. Just to focus a textarea may be not enough in my case.</em></p>