テキストボックスのクリックで表示される作業ドロップダウンがありますが、常にキーアップに表示したいと思います。私はキーアップ機能が働いていますが、入力後にクリックしてドロップダウンを表示させる必要があります。 キーアップでのブートストラップのドロップダウン
//This calls the delay function and will result in the customerNameUL_Populate function being called after the delay has passed.
function customerNameSearchTextbox_keyup() {
delay(function() {
if ($('#customerNameSearchTextbox').val().length > 0) {
customerNameUL_Populate();
alert('dropdown'); //http://getbootstrap.com/javascript/#dropdowns
$('#customerNameSearchTextbox').dropdown(); <----- ?
}
else {
$('#customerNameUL').empty();
};
}, 500);
};
//This function gets called to populate the list of customers for search
function customerNameUL_Populate() {
<working stuff>
};
<div class="dropdown">
<input type="text" id="customerNameSearchTextbox" class="form-control" placeholder="Customer" aria-describedby="basic-addon1" data-toggle="dropdown" onkeyup="customerNameSearchTextbox_keyup();" autocomplete="off">
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1" id="customerNameUL">
</ul>
</div>
私は私が持っていると思う混乱が呼び出す、または何のクラスに割り当てるために、またはどのようなイベントを呼び出すためにどのようなイベントです。上記のアラートが消えて、私はどこに行きたいのかわかります。customerNameULを表示させるには、下の行を置き換えるだけです。
は、私は信じている - これは主にちょうどある場合をルックアンドゴー - あなたの問題は主に、ドロップダウンをトグルコードは上と呼ばれていることに起因していることそれらが使用するデータトグルアトリビュートを参照するクリックが表示されます。あなたが言いたいのであれば、データトグルを表示されていない別の要素に追加し、あなたが望むようにできる '$()。dropdown() 'を呼び出すだけです。 – Jhecht