Bootstrap switch.js 開關外掛 api
阿新 • • 發佈:2019-02-06
onText:"照明",
offText:"熄滅",
onColor:"success",
offColor:"info",
size:"small",
onSwitchChange:function(event,state){
if(state==true){
$(this).val("1");
console.log("開啟");
}else{
$(this).val("2");
console.log("關閉");
}
}
}); $("#close").click(function(){
$('[name="status"]').bootstrapSwitch('state', false); // 關閉按鈕
}); $("#open").click(function(){ $('[name="status"]').bootstrapSwitch('state', true); // 開啟按鈕 });
offText:"熄滅",
onColor:"success",
offColor:"info",
size:"small",
onSwitchChange:function(event,state){
if(state==true){
$(this).val("1");
console.log("開啟");
}else{
$(this).val("2");
}
}
}); $("#close").click(function(){
$('[name="status"]').bootstrapSwitch('state', false); // 關閉按鈕
}); $("#open").click(function(){ $('[name="status"]').bootstrapSwitch('state', true); // 開啟按鈕 });