-1

I am facing is weird problem. I have an input field on my page which gets its feed from a barcode scanner which appends a carriage return at the end (keycode: 13). When I use my scanner on a regular notepad, Once the input prints on screen, the cursor moves to the next line (it gets the carriage return), where as if I do the same thing on the <INPUT> tag, it never gives the carriage return. I tried <textarea> as well, but with no luck. How to tackle this issue?

2
  • Maybe try inserting a \r for a carriage return Commented Oct 1, 2010 at 18:35
  • Can you point your cursor to the demo box on api.jquery.com/keydown and see the result (in which). Hopefully the last key that's sent is the actual return. Commented Oct 1, 2010 at 18:59

1 Answer 1

1

I did this with a barcode scanner that could not append CR.

What I did was start a timer to timeout in 500 milliseconds after receiving the first character. After receiving each additional character, I'd reset the timer. When the timeout occurs, it submits the form.

So once it stops receiving characters, it submits the form.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.