Accordion have to collapse on checked checkbox. And must be hidden when it's uncheked.
Here is code : http://jsfiddle.net/UwL5L/2/
Why it doesn't checks?
<div class="panel-group driving-license-settings" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<input type="checkbox" value=""> I have Driver License
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<div class="driving-license-kind">
<div class="checkbox">
<input type="checkbox" value="">A
</div>
<div class="checkbox">
<input type="checkbox" value="">B
</div>
<div class="checkbox">
<input type="checkbox" value="">C
</div>
<div class="checkbox">
<input type="checkbox" value="">D
</div>
<div class="checkbox">
<input type="checkbox" value="">E
</div>
</div>
</div>
</div>
</div>
</div>
Look at it. I did it and works fine.
Here's my solution, works by adding a label wrapper to the checkbox instead of a hyperlink:
http://jsfiddle.net/L0h3s7uf/1/
I was facing the same problem and I've found the answer on this video: http://www.lynda.com/Bootstrap-tutorials/Adding-check-box-using-collapse-enhance-usability/161098/176537-4.html I hope it helps! I'm using it now to collapse a full div below a checkbox, very simple. The only problem is if you double click it fast it gets messed, but it usually doesnt happen.
JS (Fiddle: http://jsfiddle.net/h44PJ/):
UPDATE (Fiddle: http://jsfiddle.net/h44PJ/567/):
You don't even need to initialize
.collapse
. Just change your header to:I developed a fancy checkbox toggle for collapse of accordion content.
Hope you guys like it :-)
Fiddle Link: http://jsfiddle.net/ajay1008/fkrehhna/