/ Published in: HTML
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> function toggle_checkboxes(id) { if (!document.getElementById){ return; } if (!document.getElementsByTagName){ return; } var inputs = document.getElementById(id).getElementsByTagName("input"); for(var x=0; x < inputs.length; x++) { if (inputs[x].type == 'checkbox'){ inputs[x].checked = !inputs[x].checked; } } } </script> <div id="parent_box"> <br/> <input type="button" value="Toggle checkboxes" onclick="toggle_checkboxes('parent_box')" /> </div>