mardi 27 juin 2017

Bootstrap 3 Collapse is not synchron with checkbox state

According to this question: "Twitter Bootstrap 3 collapse when checkbox checked" i've tried this solution, because it is simple and clean.

http://ift.tt/2thdOgA

<div class="panel-group driving-license-settings" id="accordion">
    <div class="panel panel-default">
        <div class="panel-heading">
             <h4 class="panel-title">
                                      <div class="checkbox">
                <label data-toggle="collapse" data-target="#collapseOne">
                    <input type="checkbox"/> I have Driver License  
                </label>
            </div>
                                  </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>

But with this "solution" you have a problem. If you click the checkbox too fast, the area is collapsed but the checkbox is checked.

How can i prevent this double clicking problem?

I am using:

  • Bootstrap 3
  • jQuery 3.1.1



Aucun commentaire:

Enregistrer un commentaire