Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么我的BootstrapSwitch不能在使用foreach构建的主干表中工作_Javascript_Jquery_Twitter Bootstrap_Backbone.js - Fatal编程技术网

Javascript 为什么我的BootstrapSwitch不能在使用foreach构建的主干表中工作

Javascript 为什么我的BootstrapSwitch不能在使用foreach构建的主干表中工作,javascript,jquery,twitter-bootstrap,backbone.js,Javascript,Jquery,Twitter Bootstrap,Backbone.js,我试图用这个漂亮的引导开关替换表中的复选框 我还使用了Backbone.marionete.js和这个链接建议的绑定处理程序 但是,我无法让绑定处理程序工作,也无法让开关在使用主干构建的表中可单击。我只是在主干视图侧的onShow()方法中添加了简单代码。这似乎是可行的 我的HTML代码 <td style="text-align:center"> <div class="make-switch"> <input class="use

我试图用这个漂亮的引导开关替换表中的复选框

我还使用了Backbone.marionete.js和这个链接建议的绑定处理程序


但是,我无法让绑定处理程序工作,也无法让开关在使用主干构建的表中可单击。

我只是在主干视图侧的onShow()方法中添加了简单代码。这似乎是可行的

我的HTML代码

 <td style="text-align:center">
      <div class="make-switch">
         <input class="userEnable" type="checkbox" checked>
      </div>
    </td>

我的主干代码

 List.Users = Marionette.CompositeView.extend({
    -----
    -----
      onShow: function() {
            $('.userEnable').wrap('<div class="make-switch">').parent().bootstrapSwitch();
            }
    }
List.Users=marionete.CompositeView.extend({
-----
-----
onShow:function(){
$('.userEnable').wrap('.parent().bootstrapSwitch();
}
}