Bootstrap 开关(switch)控件
取值
$('#switcher').bootstrapSwitch('state'); // true || false
$('#switcher').bootstrapSwitch('toggleState');
$('#switcher').bootstrapSwitch('setState', false); // true || false
html
<input name="status" type="checkbox" data-size="small">
js初始化
$('[name="status"]').bootstrapSwitch({
onText:"启动",
offText:"停止",
onColor:"success",
offColor:"info",
size:"small",
onSwitchChange:function(event,state){
if(state==true){
$(this).val("1");
}else{
$(this).val("2");
}
}
})
那是一座岛,岛上有青草,鲜花,美丽的走兽与飞鸟!

浙公网安备 33010602011771号