Thanks - for some reason I didn't see that post.
Going to work out if that will fix the issue.
Frustrating thing is that I bought 2 jquery books (one dedicates 1 page to it and the other doesn't even mention autocomplete!)
Currently, it is complaining about a "}" not being closed.
My current code is:
$(function() {
$('#query').autocomplete({
source: function(request, response) {
$.ajax({
url: 'get_json.php',
dataType: 'json',
data: { q: request.term },
success: function(data) {
response($.map(data, function(item) {
return {label: __highlight(item.title, request.term) + " (" + item.type + ")",
value: item.title};
}));
}
});
},
minLength: 3)
.data( "autocomplete" )._renderItem = function( ul, item ) {
// only change here was to replace .text() with .html()
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( $( "<a></a>" ).html(item.label) )
.appendTo( ul );
};
});
function __highlight(s, t) {
var matcher = new RegExp("("+$.ui.autocomplete.escapeRegex(t)+")", "ig" );
return s.replace(matcher, "<strong>$1</strong>");
}