jeudi 14 janvier 2016

How to uncheck a checkbox even if one among the list is unchecked?

I am trying a check a checkbox (which checks all other checkboxes in the list and unchecks even if one among the list is unchecked. Now only the first I mean one checkbox checking all the remaining checkboxes in the list is happening but the vice versa I mean unchecking even if one among the list in unchecked is not working. How can i achieve that?

<label><input type="checkbox" name="sample" class="selectall"/> Select all</label>

<div id="checkboxlist">
<label><input type="checkbox" name="sample"/>checkbox1</label><br/>
<label><input type="checkbox" name="sample"/>checkbox2</label><br />
<label><input type="checkbox" name="sample"/>checkbox3</label><br />
<label><input type="checkbox" name="sample"/>checkbox4</label><br />

 </div> 

Fiddle.




Aucun commentaire:

Enregistrer un commentaire