2014-08-27 60 views
1

我想在引導下拉列表中使用劍道組合框。劍道ComboBox內的引導下拉列表

我創建了一個樣本小提琴..

http://jsfiddle.net/w32LvL18/3/

問題是,當我嘗試輸入組合框中的東西,我無法瀏覽到使用向下箭頭鍵的其他選項。當我嘗試使用向下箭頭鍵,跳轉到的下拉列表中第一個選項,而不是組合框的選項。我怎樣才能改變這種...

$('#keep_open_dropdown').on("click", function (e) { 
      e.stopPropagation(); // This replace if conditional. 
}); 

回答

1

一種解決方案是簡單地從取出role="menu"屬性bootstrap下拉菜單並禁用bootstrap下拉菜單的鍵盤導航。

<ul id="dropdown-items" class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"> 

另一種解決方案,當你想保持鍵盤導航也爲bootrap下拉列表中,正趕上打開和關閉事件,並添加或刪除角色屬性。

這裏是更新的fiddle

... 
close: function(){ 
    $('#dropdown-items').attr('role', 'menu');   
}, 
open: function(){ 
    $('#dropdown-items').removeAttr('role'); 
}, 
....