在我的java脚本中,我尝试显示typeahead。它不会显示输入第一个字母的国家/地区,但是当我输入第二个字母时它会显示。
我的脚本是
$('#country_v1-query').typeahead({
order: "desc",
source: {
data: [
"Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe"
]
},
callback: {
onInit: function (node) {
console.log('Typeahead Initiated on ' + node.selector);
}
}
});
我用这样的id
来调用脚本 <input type="text" id="country_v1-query" name="country_v1[query]" autocomplete="on" class=" typeahead" data-provide="typeahead" />
包含链接
typeahead.js, typeahead.css, jquery-ui.js, jquery-ui.css, bootstrap.min.css
答案 0 :(得分:0)
我得到了答案,我在我的脚本中插入了minLength: "1",
。