Skip to content

Instantly share code, notes, and snippets.

@PilotBob
Created April 10, 2012 19:26
Show Gist options
  • Save PilotBob/2353856 to your computer and use it in GitHub Desktop.
Save PilotBob/2353856 to your computer and use it in GitHub Desktop.
function AutoCompleteGetIdValue(elem) {
var testValue = $(elem).val();
var id;
$(elem).data().autocomplete.widget().children(".ui-menu-item").each(function () {
var item = $(this).data("item.autocomplete")
if (item.value == testValue) {
alert(item.id);
id = item.id;
}
});
return id;
}
the alert displays the correct value but the id on the return line shows "undefined" in my debugger?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment