在这里,我使用了一个自动建议插件,
我在获取所选值时遇到问题。
var data = {items: [
{value: "21", name: "Mick Jagger"},
{value: "43", name: "Johnny Storm"},
{value: "46", name: "Richard Hatch"},
{value: "54", name: "Kelly Slater"},
{value: "55", name: "Rudy Hamilton"},
{value: "79", name: "Michael Jordan"}
]};
$("#search_query_top").autoSuggest(data.items, {
selectedItemProp: "name",
selectionLimit: 1,
searchObjProps: "name",
startText: "Search by name,",
resultClick: function(items){ console.log(items);}
});
请,任何人都可以帮助我解决这个问题,
谢谢