我正在使用Bootstrap Switch进行Twitter Bootstrap.在这里,我有问题检查或取消选中基于全局复选框选中或取消选中的所有复选框
这是bootstrap交换机链接http://www.bootstrap-switch.org/
这就是我所做的
<!-- this is the global checkbox -->
<div class="make-switch switch-mini">
<input type="checkbox" id="rowSelectAll">
</div>
<!-- row checkboxs -->
<div class="make-switch switch-mini">
<input type="checkbox" class="row-select">
</div>
<div class="make-switch switch-mini">
<input type="checkbox" class="row-select">
</div>
<div class="make-switch switch-mini">
<input type="checkbox" class="row-select">
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$("#rowSelectAll").click(function () {
$(".row-select").prop('checked', $(this).prop('checked'));
});
Run Code Online (Sandbox Code Playgroud)
编辑:尝试只有一个全局和一个本地复选框
<div class="make-switch switch-mini">
<input type="checkbox" id="rowSelectAll">
</div>
<div id="toggle-state-switch" class="make-switch switch-mini row-select">
<input type="checkbox" class="">
</div>
Run Code Online (Sandbox Code Playgroud) 我能找到的最接近当前困境的物理描述是在HTML/PHP if-else语句中,主要问题相似之处在于按钮状态的变化.由于我没有在twitter-bootstrap中尝试任何操作,因此我的问题与该参考点不同.我正在处理克服(最初)可怕的内容发布和撤回系统的编码.
这段代码;
echo '<input type="submit" name="action" value="Edit" />';
if ($row['is_published'] || $row['date_published']) {
if($action == 'Retract') {
echo '<input type="submit" name="action" value="Retract"/>';
} else {
if($action == 'Publish') {
echo '<input type="submit" name="action" value="Publish"/>';
}
}
}
if($row['access_level'] > 1 || $_SESSION['access_level'] > 1){
echo '<input type="submit" name="action" value="$action" />';
}
echo'<input type="submit" name="action" value="Delete"/>';
Run Code Online (Sandbox Code Playgroud)
返回提交输入的结果为;
_____________ ____________ ____________
| | | |
| EDIT | $ACTION | DELETE |
|_____________|____________|____________|
Run Code Online (Sandbox Code Playgroud)
我知道我做了一些简单的错误,因为$ACTION …