jquery - bootstrap-switch check box value always "on" -
i developing cms , on add form i'm using bootstrap-switch in form. return checked
or on
value.
code
<html> <head> <link rel="stylesheet" type="text/css" href="http://www.bootstrap-switch.org/docs/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="http://www.bootstrap-switch.org/dist/css/bootstrap3/bootstrap-switch.css"> <script type='text/javascript' src="http://www.bootstrap-switch.org/docs/js/bootstrap.min.js"></script> <script type='text/javascript' src="http://www.bootstrap-switch.org/dist/js/bootstrap-switch.js"></script> <script type='text/javascript'> $(window).load(function(){ var s = $('#status').val(); $("#status").change(function(){ alert(s); }); }); </script> </head> <body> <input type="checkbox" id="status" name="status" checked> </body> </html>
just read checked status in way:
$("#status").change(function(){ alert(this.checked); });
Comments
Post a Comment