How do we go about doing jQuery UI autocomplete with an input box with some populated data?
<input type="text" name="myField" value="Some prepopulated data here," class="vest">
Notes:
(1) The "Some prepopulated data here" is retrieved from a database via a query
(2) The autocomplete list is supposed to show up when a user moves cursor into this field
Outcome for the field would be: Some prepopulated data here, An Unmarried Woman
if "An Unmarried Woman" is selected.
$(function() {
var vList = ["An Unmarried Woman","Married Couple"];
$(".vest").autocomplete({
source: vList,
select: function(event, ui) {
this.value = this.value + ui.item.value;
}
});
});
Thanks.