Jörn, >Could we hijack the current result event for this? Currenlty nothing is >returned. If the user doesn't want the result, he could return false or >whatever to prevent it. Switching the order in which the result is set >to the input and the callback is executed shouldn't be a problem.
What I was thinking was something like this: function dataToDom() { var num = limitNumberOfItems(data.length); for (var i=0; i < num; i++) { var bProcessRow = options.onProcessRow ? options.onProcessRow(data[i]) : true; if (!data[i] || !bProcessRow ) continue; function highlight(value) { return value.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>"); } jQuery("<li>").html( options.formatItem ? highlight(options.formatItem(data[i].data, i+1, num)) : highlight(data[i].value) ).appendTo(list); } listItems = list.find("li"); if ( options.selectFirst ) { listItems.eq(0).addClass(CLASSES.ACTIVE); active = 0; } } Now, if the user defines an onProccessRow function, they can control whether or not to display the current item. On a side note, I think maybe the "highlight" function should be optional. I could see where that would be that could be problematically if you're using the formatItem() function. The highlight code you're using code break HTML. -Dan