<input type="checkbox" checked id="stateswitch">
<input type="hidden" name="reg" id="regval" value="true">
<link rel="stylesheet" href="https://cdn.staticfile.org/bootstrap-switch/3.3.4/css/bootstrap3/bootstrap-switch.min.css">
<script src="https://cdn.staticfile.org/bootstrap-switch/3.3.4/js/bootstrap-switch.min.js"></script>
<script type="text/javascript">
var stat = 'true'
$('#stateswitch').bootstrapSwitch({
onText : "开启",
offText : "禁止",
onColor : "success",
offColor : "danger",
size : "small",
state: stat,
onSwitchChange : function(event, state) {
$("#regval").val(state)
}
});
</script>
更多属性参考官网网站 bootstrap-switch
文档更新时间: 2020-01-12 01:04 作者:cranux