我有一组带子复选框的复选框
<div id="box-fiter-cat" class="box-filter checkbox checkbox-info">
<h6 class="lead">Categories</h6>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<?php $filteredCategories = $_GET['cat'];foreach($categories as $cat): ?>
<div class="panel panel-default">
<div id="heading-
<?php echo $cat['slug'] ?>" class="panel-heading" role="tab">
<span class="item">
<input
<?php if(in_array($cat['slug'].'.*',$filteredCategories)){ echo 'checked="checked"'; } ?> id="cat-
<?php echo $cat['slug'].'.*' ?>" type="checkbox" name="cat[]" value="
<?php echo $cat['slug'].'.*'?>">
<label for="cat-
<?php echo $cat['slug'].'.*' ?>">
<?php echo $cat['title'] ?>
</label>
</span>
<a class="pull-right" role="button" data-toggle="collapse" href="#collapse-
<?php echo $cat['slug'] ?>" aria-expanded="true" aria-controls="collapse-fund">
<i class="fa fa-chevron-down"></i>
</a>
</div>
<div id="collapse-
<?php echo $cat['slug'] ?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-
<?php echo $cat['slug'] ?>">
<ul class="list-group">
<?php foreach($cat['childs'] as $childs_cat): ?>
<li>
<span class="item">
<input
<?php if(in_array($childs_cat['slug'],$filteredCategories)){ echo 'checked="checked"'; } ?> id="cat-
<?php echo $cat['slug'] ?>-
<?php echo $childs_cat['slug'] ?>" name="cat[]" value="
<?php echo $childs_cat['slug'] ?>" type="checkbox">
<label for="cat-
<?php echo $cat['slug'] ?>-
<?php echo $childs_cat['slug'] ?>">
<?php echo $childs_cat['title'] ?>
</label>
</span>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
首次加载时,它将如下所示:
我的问题是如何确保当用户检查任何子复选框时,父面板将保持打开状态?我试图摆弄,但它导致所有其他面板打开而不是正在检查的面板。