我使用bootstrap typeahead来实现自动补全功能。我需要typeahead在输入激活时返回结果(在鼠标单击或Tab键切换到输入时),而不是等待用户键入第一个字符。更像是打字。
<input id="input01" class="input-medium" type="text" data-provide="typeahead" placeholder="TypeAhead…" autocomplete="off">
$(document).ready(function($) {
// Workaround for bug in mouse item selection
$.fn.typeahead.Constructor.prototype.blur = function() {
var that = this;
setTimeout(function () { that.hide(); }, 250);
};
$('#input01').typeahead({
source: function(query, process) {
return ["hello","world", "awesome"];
}
});
});发布于 2013-06-19 08:37:32
Bootstrp combobox工作得很完美
发布于 2013-06-14 05:41:42
我还没有使用过那个插件in a long time,但是尝试手动调用这个查找(或者现在的任何方法)。
如下所示:
$(document).ready(function($) {
var $input = $('#input01');
$input.typeahead({
source: function(query, process) {
return ["hello","world", "awesome"];
}
});
$input.on('focus', function() {
$input.typeahead.lookup();
});
});https://stackoverflow.com/questions/17097159
复制相似问题