I am facing is weir开发者_开发问答d 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?
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.
精彩评论