请问jquery.autocomplete 怎样使它的提示框一开始加载页面时候就显示出来,而不是需要通过单击文本框,或者输入字符
问题原因:我通过jquery.autocomplete
/***************************************/
想要通过js 改变传入的json的值 从而改变提示框内显示的内容
但是如果一开始不能显示下拉提示框的话 就会出现多个下拉提示框重叠的现象,请各位高人 帮我解决 非常感谢(附件 是我写的一个demo)
如
var stockInfoJson1 = [
{ name: "深发展A", code: "000001",spell:"sfza" },
{ name: "万科A", code: "000002",spell:"wka"},
{ name: "ST 国 农", code: "000004",spell:"stgn" },
{ name: "世纪星源", code: "000005",spell:"sjxy" },
{ name: "深振业A", code: "000006" ,spell:"szya"},
{ name: "ST 达 声", code: "000007" ,spell:"stds"},
{ name: "ST宝利来", code: "000008" ,spell:"stbll"},
{ name: "中国宝安", code: "000009" ,spell:"zgba"},
{ name: "S ST华新", code: "000010" ,spell:"ssthx"},
{ name: "山航B", code: "200152" ,spell:"shb"},
{ name: "*ST帝贤B", code: "200160" ,spell:"stdxb"},
{ name: "雷伊B", code: "200168" ,spell:"lyb"},
{ name: "宝石B", code: "200413",spell:"bsb" },
{ name: "小天鹅B", code: "200418" ,spell:"xteb"},
{ name: "粤高速B", code: "200429" ,spell:"agsb"},
{ name: "宁通信B", code: "200468" ,spell:"ltxb"},
{ name: "晨鸣B", code: "200488" ,spell:"cmb"},
{ name: "珠江B", code: "200505" ,spell:"zjb"},
{ name: "闽灿坤B", code: "200512" ,spell:"mskb"},
{ name: "华电国际", code: "600027" ,spell:"hdgj"}
];
var stockInfoJson2 = [
{ name: "深发展A", code: "000001",spell:"sfza" },
{ name: "万科A", code: "000002",spell:"wka"},
{ name: "ST宝利来", code: "000008" ,spell:"stbll"},
{ name: "中国宝安", code: "000009" ,spell:"zgba"},
{ name: "S ST华新", code: "000010" ,spell:"ssthx"},
{ name: "ST 国 农", code: "000004",spell:"stgn" }
];
////////////////////////////////////////////////////////////////////////////////////////////
$("#suggest1").autocomplete(stockInfoJson, {
minChars: 1,
matchCase:false,//不区分大小写
autoFill: false,
max: 10,
formatItem: function(row, i, max,term) {
//$("
var v = $("#suggest1").val();
return row.name + " (" + row.code + ")";
if(row.code.indexOf(v) == 0 || row.spell.indexOf(v)==0)
{
return row.name + " (" + row.code + ")";
}
else
return false;
},
formatMatch: function(row, i, max) {
//alert("uu"); alert(max);
return row.name + " (" + row.code+")";
},
formatResult: function(row) {
//alert("jquery");
return row.code;
},
reasultSearch:function(row,v)//本场数据自定义查询语法 注意这是我自己新加的事件
{
//自定义在code或spell中匹配
if(row.data.code.indexOf(v) == 0 || row.data.spell.indexOf(v) == 0)
{
return row;
}
else
return false;
}
});
$("#suggest1").result(function(event, data, formatted) {
//如选择后给其他控件赋值,触发别的事件等等
alert("success");
});
/***************************************/
想要通过js 改变传入的json的值 从而改变提示框内显示的内容
但是如果一开始不能显示下拉提示框的话 就会出现多个下拉提示框重叠的现象,请各位高人 帮我解决 非常感谢