js改變bootstrap switch的選中與否
阿新 • • 發佈:2019-01-22
無線開關:<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/