Jquery typeahead.js:如何单击打开菜单
我正在尝试打开Jquery typeahead.js:如何单击打开菜单,jquery,typeahead.js,Jquery,Typeahead.js,我正在尝试打开单击事件上的建议菜单。根据文档应该打开菜单,但对我来说不起作用 html: js: var国家=新猎犬({ datumTokenizer:Bloodhound.tokenizers.whitespace, queryTokenizer:猎犬,标记,空白, 预回迁:“” }); $(“#客户名称”).typeahead(空{ 名称:'国家', 资料来源:国家 }); $('.operation create.glyphicon search')。单击(函数(){ $('客户名称'
单击事件上的建议菜单。根据文档应该打开菜单,但对我来说不起作用
html:
js:
var国家=新猎犬({
datumTokenizer:Bloodhound.tokenizers.whitespace,
queryTokenizer:猎犬,标记,空白,
预回迁:“”
});
$(“#客户名称”).typeahead(空{
名称:'国家',
资料来源:国家
});
$('.operation create.glyphicon search')。单击(函数(){
$('客户名称').typeahead('打开');
});
单击Glyph图标时,菜单元素中添加了一个“tt open”类,但其显示仍为无,且数据未加载。是否需要将class=“typeahead”
作为一个类@morne它的功能相同,有类和无类
<div class="inner-addon right-addon">
<i class="glyphicon glyphicon-search"></i>
<input type="text" id="customer_name" name="Operation[customer_id]" class="form-control" placeholder="Mention Customer Name"/>
</div>
var countries = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '<?= Yii::getAlias('@web').'/js/countries.json'; ?>'
});
$('#customer_name').typeahead(null, {
name: 'countries',
source: countries
});
$('.operation-create .glyphicon-search').click(function(){
$('#customer_name').typeahead('open');
});