js改变bootstrap switch的选中与否

来源:互联网 发布:win2008 dhcp数据迁移 编辑:程序博客网 时间:2024/06/11 09:45


无线开关:<div id="wlan_enable_div" class="make-switch" data-on="success" data-off="warning"><input type="checkbox" id="enable" name="enable" checked></div>



    if(info.WLANConfiguration.Enable=='1')
    {//无线打开
        $('#wlan_enable_id').bootstrapSwitch('toggleState');
        $('#wlan_enable_id').bootstrapSwitch('setState', true);    
    }else
    {//无线关闭
        $('#wlan_enable_div').bootstrapSwitch('toggleState');
        $('#wlan_enable_div').bootstrapSwitch('setState', false);
    }


具体见官网 http://www.bootcss.com/p/bootstrap-switch/

Toggle State


0 0
原创粉丝点击