Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check all if one checkbox is checked

Status
Not open for further replies.

magmo

Programmer
May 26, 2004
291
SE
Hi


I wonder if there is a way to automatically check a group of checkboxes if the client check one of them?


Regards
 
Like this?
Code:
<script>
function checkAll(c){
  var chks = document.getElementsByName(c.name);
  for(var i=0;i<chks.length;i++){
    chks[i].checked = c.checked;
  }
}
</script>
<input type="checkbox" name="myCheck" onclick="checkAll(this)">
<input type="checkbox" name="myCheck" onclick="checkAll(this)">

Adam
 
Hi



That is just brilliant! Thanks a lot



Best Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top