https://github.com/Bttstrp/bootstrap-switch ---------------------- <link href="bootstrap.css" rel="stylesheet"> <link href="bootstrap-switch.css" rel="stylesheet"> <script src="jquery.js"></script> <script src="bootstrap-switch.js"></script>
<input type="checkbox" name="my-checkbox" checked> <script> $("[name='my-checkbox']").bootstrapSwitch(); </script> ------------------------------ <script type="text/javascript"> $('[name="status"]').bootstrapSwitch({ onText:"启动", offText:"停止", onColor:"success", offColor:"info", size:"small", onSwitchChange:function(event,state){ if(state==true){ alert('已打开'); }else{ alert('已关闭'); } } }) </script> ------------------------------- 这个不影响原来的真checkbox,直接用jquery判断checkbox是否选中就行了。
|