1

I am using jQuery UI with a text box. When the user selects from the drop down list of possible matches, I want to get the index of the selection from the source array, assuing a JavaScript array.

Is there any way to do this?

1

1 Answer 1

2

You could do something like this:

select: function(event, ui) {
    console.log($.inArray(ui.item.value, availableTags));
}

where availableTags is the autocomplete's source array.

jsFiddle example

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.