このプラグインをオートコンプリートに使用しています
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete
ユーザーがテキストボックスをクリックすると、すべての結果を含むdivが表示されるようにしたいと思います
試しまし$("#textbox").search()
たが、機能しません
どのようにできるのか?
ありがとう
このプラグインをオートコンプリートに使用しています
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete
ユーザーがテキストボックスをクリックすると、すべての結果を含むdivが表示されるようにしたいと思います
試しまし$("#textbox").search()
たが、機能しません
どのようにできるのか?
ありがとう
この機能をプラグインに追加する方法についてのfarrukhazizによるチュートリアルは次のとおりです。http://plugins.jquery.com/node/10336
プラグインのソースコードを編集する必要があります。
ソースのこのセクションに「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");
}
このセクションの「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();
});
これを試して:
$('#textbox').click(function() {
$(this).trigger('focus');
});
これを試してみてください:
var input = $('#myinput');
input.autocomplete(data, {minChars: 0});
input.focus(function(){ input.keypress(); });