jquery控制bootstrapswitch

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf8">
    <meta http-equiv="x-ua-compatible" content="IE=9">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <!-- css     -->
    <link rel="stylesheet" href="../static/css/rostyle.css" type="text/css">
    <link rel="stylesheet" href="../static/css/bootstrap3.css" >
    <!--增加button-switch-css-->
    <link rel="stylesheet" href="../static/css/bootstrap-switch.css">
    <meta name = "viewport" content = "initial-scale = 1, user-scalable = yes">
   <!-- <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=yes"/> -->
<!-- js file -->
<script type="text/javascript" src="../static/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../static/js/bootstrap3.min.js"></script>
<!--增加button-switch-js-->          
<script type="text/javascript"  src="../static/js/bootstrap-switch.js"></script>

       </head>
        
  <body id="home">

DHCP服务器:<input type="checkbox" id="dhcpd" checked></br></br>

</body>

 </div>

</html>

++++++++++

js


        if(info.DHCPD.DHCPServerEnable=='0')
        {//DHCPD服务是否开启,0 – 关闭。
            $('#dhcpd').removeAttr("checked");
            $('#dhcpd').wrap('<div class="make-switch" data-on="success" data-off="warning" />').parent().bootstrapSwitch();            
        }else if(info.DHCPD.DHCPServerEnable=='1')
        {//DHCPD服务是否开启,1 – 开启
            $('#dhcpd').attr("checked", "checked");
            $('#dhcpd').wrap('<div class="make-switch" data-on="success" data-off="warning" />').parent().bootstrapSwitch();                    
        }

你可能感兴趣的:(jquery控制bootstrapswitch)