javascript - 带有附加功能的 Bootstrap 组合框不起作用

标签 javascript twitter-bootstrap combobox

我有一个组合框,需要在单击按钮时附加,我如何执行代码$(document).ready(function(){$('.combobox').combobox();}) ; 在附加的组合框中,如果它是一个现成的函数?

提前谢谢您。

来自此网站。 https://github.com/danielfarrell/bootstrap-combobox/

最佳答案

您需要在附加新选择之后调用$('.combobox').combobox();} - 它只会在统治。

例如:

$(document).ready(function(){
  // convert selects already on the page at dom load
  $('select.form-control').combobox();  

  //add selects
  $('#addSelect').click(function(e){
    //create select
    $('<select class="form-control"/>').append('<option>1</option><option>2</option>')
        //add to dom
        .appendTo('#addHere')
        //convert to combobox
        .combobox();
  });
});

参见this demo bootply一个功能示例

关于javascript - 带有附加功能的 Bootstrap 组合框不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29249914/

相关文章:

c# - WPF 组合框 : Set SelectedItem to item not in ItemsSource -> Binding oddity

javascript - 如何使用javascript获取每行中多个输入字段的百分比

javascript - 围绕 Angular $http 请求创建函数

sql - dlookup 多个表并将文本框设置为结果 Access 2007

javascript - 使用 Meteor 更改选项卡

javascript - 如何从 Bootstrap carousel jQuery 中的对象数组设置背景图像?

c# - ComboBox 文本垂直居中对齐

javascript - 在 Javascript 中模拟纯虚函数

javascript - tinymce setcontent 使现有消失

twitter-bootstrap - 模态 Bootstrap 随着更改事件 meteor 消失