0

After a bit of research I stumbled onto this example. It was a nice example but not exactly what I was looking for.

What I'm trying to do is this, I have a barcode scanner connected to my PC, and i want to be able to scan something into a form field and it automatically move to the next line regardless of how many numbers have been scanned (UPC-A or UPC-E) from the barcode.

And I felt the best way to do that is after the field is been filed with code/numbers it waits 1 second and moves to the next line. Or if someone has another suggestion on moving to the next line, I'm open to suggestions, i just want it to work.

Community
  • 1
  • 1
Outdated Computer Tech
  • 1,996
  • 4
  • 25
  • 39

1 Answers1

1

using jQuery, and assuming that your barcode scanner simulates a keyboard (and therefore sends keyboard events):

var timer;
$('input').keyup(function() {
    clearTimeout(timer);

    var input = $(this);
    var timer = setTimeout(function(){
       input.next('input').focus();
    }, 1000);
});

http://jsfiddle.net/r595Y/

flochtililoch
  • 6,057
  • 2
  • 21
  • 20