views:

102

answers:

1

I am converting from YUI to jQuery and can't see a way to load the results of the autocomplete into a div or other such container.

I want to be able to populate a div with formatted results, including an image based on the return, not just a simple drop down from the input.

A: 

DEMO: http://jsbin.com/ibezi3

$("#autocomplete").autocomplete({
    open: function(event, ui) {
        $('ul.ui-autocomplete').removeAttr('style').hide().appendTo('div').show();
    }
});

then access single element by it's class .ui-menu-item

example would be

$('.ui-autocomplete li').each(function() {
if ( $(this).text() == 'javascript' )
     $(this).append('<img src="" alt="" />');
});
aSeptik