在jQuery自动完成和刷新列表中添加控件
我正在显示列表项在jQuery自动完成结果中为每个项选择的次数的排名信息。现在,我想在自动完成中为每个项目添加一个控件,单击它会降低排名,也会刷新自动完成列表 代码:在jQuery自动完成和刷新列表中添加控件,jquery,jquery-ui,jquery-plugins,autocomplete,Jquery,Jquery Ui,Jquery Plugins,Autocomplete,我正在显示列表项在jQuery自动完成结果中为每个项选择的次数的排名信息。现在,我想在自动完成中为每个项目添加一个控件,单击它会降低排名,也会刷新自动完成列表 代码: if (item.Value != null && item.Value != "" && item.Value != "0") { return $("<li></li>") .data
if (item.Value != null && item.Value != "" && item.Value != "0") {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a style='color:Blue;'>" + item.label + "<span id='ancClearRanking' style='float:right;z-index:1000;' class='clearranking'>X</span><span id='spn`enter code here`Ranking' style='color:Green;font-size:10px;float:right;'>(" + item.Value + ")</span>" + "</a>")
.appendTo(ul);
}
$(document).delegate("ul .clearranking", "click", function (e) {
var isConfirmed = confirm("Are you sure you want to delete?");
if (isConfirmed) {
$(inputcontrol).autocomplete("search");
}
});
我面临两个问题
1单击清除排名时,首先调用选择函数。我想限制这一点
2触发$inputcontrol.autocompletesearch未触发
请提供帮助。请提供复制此文件所需的其余代码。我已经创建了一个模拟案例