title: Refreshing the input box everytime a new scan happens. jQuery - Scannerdetection api
body: <p>I want to develop a simple web application using the jQuery scanner detection api. I have followed the tutorials in the given two links.</p>
  
  <p><a href="http://a.kabachnik.info/jquery-scannerdetection-tutorial.html" rel="nofollow noreferrer">jQuery.ScannerDetection - tutorial &amp; best practices</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11290898/detect-when-input-box-filled-by-keyboard-and-when-by-barcode-scanner/15354814#15354814">Detect when input box filled by keyboard and when by barcode scanner.</a></p>
  
  <p>This is my code</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="./scanner_detection/jquery.scannerdetection.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $(document).scannerDetection({
              timeBeforeScanTest: 200, // wait for the next character for upto 200ms
              startChar: [120], // Prefix character for the cabled scanner (OPL6845R)
              endChar: [13], // be sure the scan is complete if key 13 (enter) is detected
              avgTimeByChar: 40, // it's not a barcode if a character takes longer than 40ms
              onComplete: function(barcode, qty){ ... } // main callback function 
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      Barcode&lt;br&gt;
      &lt;input id="barcode" type="text" value="Barcode appears here"&gt;
      &lt;script&gt;
          $(window).ready(function(){
              console.log('all is well');
              $(window).scannerDetection();
              $(window).bind('scannerDetectionComplete',function(e,data){
                  console.log('complete '+data.string);
                  $("#barcode").val(data.string);
              })
                  .bind('scannerDetectionError',function(e,data){
                  console.log('detection error '+data.string);
              })
                  .bind('scannerDetectionReceive',function(e,data){
                  console.log('Recieve');
                  console.log(data.evt.which);
              })
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I scan a barcode the barcode value is appearing in the input box but when a second scan happens the second barcode value is appending to the previous one. How do I clear the previous barcode everytime a new scan happens?</p>
  
  <p>When I scan two barcodes the input box looks like this.</p>
  
  <p><a href="https://i.stack.imgur.com/2XInm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2XInm.png" alt="enter image description here"></a></p>
  
  <p>How can I refresh the text box every time a new scan happens?</p>