I would like the suggestions that autocomplete gives me not only appear in the dropdown below the input field. So I want to show the current suggestions in two containers.
$( "#project" ).autocomplete({
minLength: 0,
source: projects,
focus: function( event, ui ) {
$( "#project" ).val( ui.item.land );
return false;
},
select: function( event, ui ) {
$( "#project" ).val( ui.item.jurisdiction );
//$( "#project-id" ).val( ui.item.value );
$( "#project-description" ).html( ui.item.company );
return false;
},
change: function( event, ui ) {
$('#resultsDistributor').html("");
}
})
.autocomplete( "instance" )._renderItem = function( ul, item ) {
return $( "<li>" )
.append( "<div>" + item.company + "<br>" + item.jurisdiction + "</div>" )
.appendTo( ul );
};
_renderItem is doing the dropdown. In the following, absolutely wrong example, it becomes clearer what I intend.
[...]
.autocomplete( "instance" )._renderItem = function( ul, item ) {
return $( "<li>" )
.append( "<div>" + item.company + "<br>" + item.jurisdiction + "</div>" )
.appendTo( ul );
return $( "#resultDistributor" )
.append( "<div>" + item.company + "<br>" + item.jurisdiction + "</div>" );
};
You can try, Change this line
to below lines