mardi 21 janvier 2020

JQuery Uncheck checkboxes in Dropdown Menu

I have a dropdown menu containing checkboxes for multiple selection. Every time, I check a few of them and then go to another page and then return to the page with the dropdown (by using the back button in chrome) the dropdown checkboxes are still checked, but they are not selected.

<div class="dropdown">
     <button type="button" id="bereiche1" value="<?php echo $bereich[0];?>" class="btn dropdown-toggle mr-1" data-toggle="dropdown">
                          Bereich
                        </button>
                          <ul class="dropdown-menu scrollable-menu" id="bereiche" role="menu">
                              <?php foreach($bereich as $item){ ?>
                                <li><a value="<?php echo $item; ?>" tabIndex="-1"><input type="checkbox"/> <?php echo $item; ?></a></li>
                              <?php } ?>
                              <li><a value="all" tabIndex="-1" style="background-color: lightgreen"><input type="checkbox"/> Alle Bereiche</a></li>
                          </ul>
                      </div>

Can somebody tell my how to overcome this problem, to keep them checked and selected? Or at least uncheck the ones that are not selected.




Aucun commentaire:

Enregistrer un commentaire