我想將相同的自動完成綁定到兩個輸入字段。jQuery自動完成,如何綁定到兩個輸入字段?
字段:
<input id="rwF1" maxlength="250" type="text" value="">
<input id="rwF2" maxlength="250" type="text" value="">
然後我autocompleter jQuery中:
$("#rwF1, #rwF2").autocomplete({
source: availableTags
}).data("autocomplete")._renderItem = function(ul, item) {
return $('<li class="roomWizardLI"></li>')
.data("item.autocomplete", item)
.append("<a><span class='title'>" + item.value + "</span><span class='Count'>" + "2" + " members</span></a>")
.appendTo(ul);
};
雖然這種結合並自動完成菜單出現在兩個輸入端。自定義的renderItem只適用於第一個輸入字段。第二個完全被忽略。任何想法爲什麼以及如何使自動完成適用於兩個輸入字段?
由於
「集中」的一個是太棒了!非常感謝。我認爲我不會輕易想到這一點。 – AnApprentice 2012-04-20 19:45:50