This is the code I use for autocomplete. Suggested autocomplete works, but when there are no matches, I do not see No results for <query term>
$('#visitor_company_name').marcoPolo({
url: '/server/control.php',
data: {
mode: 'visit_company_name'
},
formatItem: function(data, $item) {
return data.visitor_company_name;
},
onSelect: function(selected_company, $item) {
$("#visitor_company_name").val(selected_company.visitor_company_name);
},
param: 'visitor_company_name',
minChars: 1,
delay: 500, // only start autocomplete query after 0.5 seconds
required: false
});
formatNoResults: function(q, $item) {
return '<em>No companies with name <strong>' + q + '</strong>.</em>';
},
I still do not see the results element. The only difference is the CSS style is changed from display: none
to display: block
Am I missing anything? I use the exact code for 2 other text input fields and they work fine.