Select or Unselect all Checkbox
You can use this free javascript code to Select / Unselect all the checkboxes by selecting a single check box.
Features
- There can be any number of checkboxes for selection.
- All the checkboxes can be selected just by selecting one check box in common.
- Also the same can be used to check and uncheck all in a single click.
Preview
Select or Unselect all Checkboxes:
|
Downloads
<!--Script by hscripts.com-->
<!-- Free javascripts @ https://www.hscripts.com -->
<script type="text/javascript">
checked=false;
function checkedAll (frm1) {var aa= document.getElementById('frm1'); if (checked == false)
{
checked = true
}
else
{
checked = false
}for (var i =0; i < aa.elements.length; i++){ aa.elements[i].checked = checked;}
}
</script>
<!-- Script by hscripts.com -->
- Release Date - 20.06.2007
- Get free version without ©copyright link for just $10/-
- For customization of this script or any script development, mail to support@hscripts.com
Usage
- Now just copy the above free JavaScript code in your web page inside the head tag.
- Create any number of check boxes and place in a form and name that form as "frm1"
<form id ="frm1">
<input type="checkbox" name="chk1">
<input type="checkbox" name="chk2">
</form>
Create a common checkbox in the form and name its as "checkall". Now Call the function checkedAll(frm1) by using onclick event.<input type='checkbox' name='checkall' onclick='checkedAll(frm1);'>
License
Related Scripts