jQuery UI的自动完成,加载结果到不同的位置(DIV)? [英] jQuery UI Autocomplete, load results to a different location(div)?
问题描述
我从YUI转换为jQuery和不能看到的方式来自动完成的结果加载到一个div或其他这样的容器。
我希望能够填充一个div格式的结果,包括基于回报的图像,不只是一个简单的下跌从输入了。
DEMO:的http://so.devilmay$c$c.it/jquery-ui-autocomplete-load-results-to-a-different-locationdiv/
更新
块引用>$(#自动完成)。自动完成({
打开:函数(事件,UI){
$($('ul.ui-自动完成')removeAttr('风格')隐藏()。)appendTo('格')显示()。
}
});然后用它的类访问单个元素
的.ui菜单项
例子是
$('。UI的自动完成立')。每个(函数(){
如果($(本)的.text()=='的javascript)
$(本).append('&下; IMG SRC =ALT =/>');
});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.
解决方案DEMO: http://so.devilmaycode.it/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="" />'); });
这篇关于jQuery UI的自动完成,加载结果到不同的位置(DIV)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!