klox
klox

Reputation: 2093

setfocus the data in textfield after scan barcode

i'm using jQuery for my task. Then i'm using barcode scanner for input data into my input form. how do i do to show data(setfocus) in the 2nd textfield, if i have two textfields inside this form?

Upvotes: 0

Views: 505

Answers (1)

Nick Craver
Nick Craver

Reputation: 630469

You can use :eq() or .eq() to get the second <input> then call .focus(), like this:

$("form input:text:eq(1)").focus()

Note that it's 1 because it's a 0-based index.

Upvotes: 1

Related Questions