JQuery UI自动完成UI [英] JQuery UI Autocomplete UI

查看:75
本文介绍了JQuery UI自动完成UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下 -



My code is like below-

$("#project").autocomplete({
    minLength: 0,
    URL: ../../,
    },
    select: function (event, ui) {
        $("#project").val(ui.item.label);
        $("#project-id").val(ui.item.value);
        $("#project-description").html(ui.item.desc);
        $("#project-icon").attr("src", "images/" + ui.item.icon);

    }
})
    .data("autocomplete")._renderItem = function (ul, item) {
    return $("<li>")
        .data("item.value", item)
        .append("<a>" + item.label + "<br>" + item.desc + "</a>")
        .appendTo(ul);
};





我在获取所有数据时也是自定义显示(项目desc在下一行项目标签)。但它阻止了选择。之前我能够选择每个项目,但在添加.data()._ renderItem部分后,我无法这样做。请说明它有什么问题。



I am getting all the data and that too in custom display( item desc is in the next line of item label). but it prevents the selection. earlier I was able to select each item but after adding the .data()._renderItem part I am not able to do so. Please suggest what's wrong in it.

推荐答案

#project)。自动完成({
minLength: 0
网址:.. / .. /,
},
select: function (event,ui){
("#project").autocomplete({ minLength: 0, URL: ../../, }, select: function (event, ui) {


#project)。val(ui.item.label);
("#project").val(ui.item.label);


#project-id)。val(ui.item.value);
("#project-id").val(ui.item.value);


这篇关于JQuery UI自动完成UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆