I don't know why I'm unable to toggle my checkbox with the code mentioned below. But the same code was working fine in another project. But, when I try to implement it in another CodeIgniter project, it doesn't work. Please help me to solve this issue.
 <form action=""  method="post" onSubmit="return checkTheBox() " name="checkboxform">';
Onclick event in a href
    echo "<td><a href='javascript:void();' onClick='javascript:checkAll('checkboxform', true);'><b>Check All</b></a> | 
     <a href='javascript:void();' onClick='javascript:checkAll('checkboxform', false);'><b>UnCheck All</b></a></td>";
Checkbox
   echo "<td><input type='checkbox' name='checkid[]' value=''</td>";
Javascript
  <script type="text/javascript">
   function checkAll(formname, checktoggle)
   {
   var checkboxes = new Array();
   checkboxes = document[formname].getElementsByTagName('input');
  for (var i = 0; i < checkboxes.length; i++) {
      if (checkboxes[i].type === 'checkbox') {
           checkboxes[i].checked = checktoggle;
          }
      }
  }
  </script>
 
     
    