Autocomplete "knows" to highlight items based on the presense of an <a>
inside each li
. You can disable keyboard selection of an event by just removing the anchor:
.data("ui-autocomplete")._renderItem = function (ul, item) {
var $el = $("<li>");
if (item.value === '') {
$el.addClass("ui-state-disabled")
.text(item.label);
} else {
$el.append("<a>" + item.label + "</a>");
}
return $el.appendTo(ul);
};
Example: http://jsfiddle.net/m6zvf/12/