views:

157

answers:

1

Hi there!

I'm looking for an autocomplete plugin that makes it easy to categorize search results. If that's unclear, take a look at Apple.com's search bar (top right).

I know that script.aculo.us' autocomplete widget provides similar functionality, by allowing you to wrap text in a [span class="informal"]. Every class="informal" element is not included in keyboard navigation.

Since I'm not too thrilled about including two different frameworks in this project, I'd love it if someone could tell me how I'd go forward in modifying one of the many autocomplete-plugins for jQuery to mimic this functionality.

Thanks, looking forward to seeing your answers!

A: 

I suggest you try jQuery autocomplete. With that, you are able to format the result in various ways. For example, the output of your function should look like "url|linkname|third var" so you are able to format the result yourself.

  function formatItem(row) {
    if (row[2] == 1)      
    {
      return (<strong>id: " + row[1] + "</strong>)";
    }
    else
    {
      return '<a href="'+row[0]+'"'>'+row[1]+'</a>';
    }
  }
MaikL80
Hi, there, and thank's for the quick reply!Will this make sure the keyboard navigation skips the STRONG-elements, and only sets focus on the links?
Henrik Lied