Jquery 打开自动完成器结果';文本框上的div单击
我正在使用这个插件进行自动完成 我希望当用户单击文本框时,所有结果的div都可见 我试过使用Jquery 打开自动完成器结果';文本框上的div单击,jquery,jquery-autocomplete,Jquery,Jquery Autocomplete,我正在使用这个插件进行自动完成 我希望当用户单击文本框时,所有结果的div都可见 我试过使用$(“#textbox”).search(),但不起作用 我该怎么办 谢谢试试这个: $('#textbox').click(function() { $(this).trigger('focus'); }); 试试这个: $('#textbox').click(function() { $(this).trigger('focus'); }); 尝试一下: var input = $(
$(“#textbox”).search()
,但不起作用
我该怎么办
谢谢试试这个:
$('#textbox').click(function() {
$(this).trigger('focus');
});
试试这个:
$('#textbox').click(function() {
$(this).trigger('focus');
});
尝试一下:
var input = $('#myinput');
input.autocomplete(data, {minChars: 0});
input.focus(function(){ input.keypress(); });
尝试一下:
var input = $('#myinput');
input.autocomplete(data, {minChars: 0});
input.focus(function(){ input.keypress(); });
以下是farrukhaziz关于如何将此功能添加到插件的教程: 您需要编辑插件源代码 将“LaunchManual”部分添加到源代码的此部分
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options){
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
},
launchManual: function() { //ADD THIS
return this.trigger("launchManual");
}
以及本节中的“启动手动”位:
}).bind("flushCache", function() {
cache.flush();
}).bind("setOptions", function() {
$.extend(options, arguments[1]);
// if we've updated the data, repopulate
if ( "data" in arguments[1] )
cache.populate();
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
}).bind("launchManual", function() { //ADD THIS
if( !cache.load( $input.val() ) )
{
cache.flush();
cache.populate();
}
lastKeyPressCode = KEY.DOWN; // equivalent of 40 (down arrow)
onChange(0, true);
});
然后您可以调用该函数以显示下拉列表:
$('#textbox').click(function() {
$(this).launchManual();
});
以下是farrukhaziz关于如何将此功能添加到插件的教程: 您需要编辑插件源代码 将“LaunchManual”部分添加到源代码的此部分
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options){
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
},
launchManual: function() { //ADD THIS
return this.trigger("launchManual");
}
以及本节中的“启动手动”位:
}).bind("flushCache", function() {
cache.flush();
}).bind("setOptions", function() {
$.extend(options, arguments[1]);
// if we've updated the data, repopulate
if ( "data" in arguments[1] )
cache.populate();
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
}).bind("launchManual", function() { //ADD THIS
if( !cache.load( $input.val() ) )
{
cache.flush();
cache.populate();
}
lastKeyPressCode = KEY.DOWN; // equivalent of 40 (down arrow)
onChange(0, true);
});
然后您可以调用该函数以显示下拉列表:
$('#textbox').click(function() {
$(this).launchManual();
});