以下是.js文件的一些代码:
var acListTotal = 0;
var acListCurrent = -1;
var acDelay = 500;
var acURL = null;
var acSearchId = null;
var acResultsId = null;
var acSearchField = null;
var acResultsDiv = null;
function setAutoComplete(field_class, results_id, get_url ){
// initialize vars
acSearchId = "." + field_class;
acResultsId = "#" + results_id;
acURL = get_url;
// create the results div
$("body").append('<div id="' + results_id + '"></div>');
// register mostly used vars
acSearchField = $(acSearchId);
acResultsDiv = $(acResultsId);
// reposition div
repositionResultsDiv();
答案 0 :(得分:1)
我没有看到将自动填充应用到文本框的实际代码。但是我可以假设它与此类似。
<input type="text" class="auto-complete" />
<input type="text" class="auto-complete" />
<input type="text" class="auto-complete" />
$(".auto-complete").autoComplete({... options ...});
你需要循环遍历它们,以便将它们设置为自己的范围
$texts = $(".auto-complete");
$.each($text, function(i, val) {
$(val).autoComplete({... options ...});
});