title: How can I add a Javascript listener to capture input from bluetooth barcode scanner to iPad?
body: <p>I'm having trouble logging keystrokes in javascript on the iPad. The following script works on Chrome and Safari, but not iPad Safari. The bluetooth barcode scanner sends 12 digits as keystrokes, then sends a return character. Does anyone have any ideas?</p>
  
  <p>I think you will need an iPad to try this out :)</p>
  
  <p>Thanks,
  Mark</p>
  
  <pre><code>$(document).ready(function(){
   $(document).keypress(function(e){
    if( e.keyCode == 13){
     alert($('#barcode').attr('value'));
     $('#barcode').attr('value','');
    }
    else{
     var key = String.fromCharCode(e.which);
     var new_val = $('#barcode').attr('value') + key;
     $('#barcode').attr('value',new_val);
    }
   });
  });
  </code></pre>