I am using jQuery UI autocomplete to select a value from a database. Everything about this is working just fine, with one exception. For the life of me, I cannot get the textbox I am writing the search value in to display the actual value after I have selected it.
I have read people having this problem many times, however the solutions they are presented are not working for me.
The fiddle is here: https://jsfiddle.net/p8y7111p/
The autocomplete code is:
$("#student_search").autocomplete({
source: "functions/find_student.php",
delay: 50,
minLength: 3,
select: function(event, ui) {
var name_person = ui.item.label; // this works to give me the name of the person
var house = ui.item.value.house;
var id = ui.item.value.id;
highlightStudent(name_person, id, house);
$('#student_search').val(name);
}
});
Note that I have tried:
replacing
namewithui.label.valuetrying adding a close or change property to autocomplete, with
$('#student_search').val(name)as its valueplacing the
$('#student_search').val(name)outside of the autocomplete
I literally cannot think of anywhere else to put stuff, and so I turn to you all.
Thank you! Alex
namecome from? Did you meanname_person?closeattribute in the fiddle, which is why there's an error. Either remove the attribute or define a function.