Reputation:
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?
Upvotes: 1
Views: 3136
Reputation: 208012
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.
Upvotes: 2