我正在开发 CMS 并在添加表单上使用 Bootstrap-switch以我的形式。但它总是返回 checked
或 on
值。
代码
<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>
最佳答案
关于jquery - bootstrap-switch 复选框值始终为 "on",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32863089/