Bootstrap switch button plug-in use.
Start by referencing bootstrap styles, scripts, and jquery.
<Linkrel= "stylesheet"href= "Static/stylesheets/bootstrap-switch.css" /><Scriptsrc= "Http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></Script> <Scriptsrc= "Static/js/bootstrap-switch.js"></Script>
Second, using the HTML language in the code, the checked represents the "on" state of the selection.
<name= "OP1" ID= "$bean. Id" type= " CheckBox "/>
Again, in the initialization scripting language, the control is styled for initialization.
$ ("Input[name= ' OP1 ')"). Bootstrapswitch ({ "small", "Danger", "open", "Close" });
Finally, in the initialization scripting language, the control is bound in a method.
$ ("Input[name= ' OP1 ')"). On (' Switchchange.bootstrapswitch ', function(E, state) {varID = $ ( This). attr ("id"); if(state = =false) {alert (Note: This item will not accept data sent by the instrument when it is closed. "); $("#" +ID). Bootstrapswitch ( "State", false); } Else { $("#" +ID). Bootstrapswitch ( "State", true); } });
Reference: http://www.cnblogs.com/tanhehe/p/4263824.html
Http://www.htmleaf.com/jQuery/Buttons-Icons/201502051331.html
Bootstrap-based ultra-cool jquery switch button plugin