开发者

jQuery UI Autocomplete, load results to a different location(div)?

开发者 https://www.devze.com 2022-12-30 23:11 出处:网络
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 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 开发者_StackOverflow中文版a div with formatted results, including an image based on the return, not just a simple drop down from the input.


DEMO: http://so.lucafilosofi.com/jquery-ui-autocomplete-load-results-to-a-different-locationdiv/

updated

$("#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="" />');
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号