mardi 23 mai 2017

pure javascript filter box having checkboxes with li elements

<p>
    <input type="checkbox" id="all"/>
    <label for="all">Select all</label>
</p>
<ul id="li-list">
    <li><input type="checkbox" id="one"/><label for="all">value 1</label></li>
    <li><input type="checkbox" id="two"/><label for="all">value 2</label></li>
    <li><input type="checkbox" id="three"/><label for="all">value 3</label></li>
    <li><input type="checkbox" id="four"/><label for="all">value 4</label></li>
</ul>

i want above code to work like-

  1. if i check select all all checkboxes should be checked
  2. if i select all checkboxes, select all should be checked. But if i unchecked one of the checkbox then select all should also be unchecked



Aucun commentaire:

Enregistrer un commentaire