<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <script src="https://unpkg.com/gijgo@1.9.13/js/gijgo.min.js" type="text/javascript"></script> <link href="https://unpkg.com/gijgo@1.9.13/css/gijgo.min.css" rel="stylesheet" type="text/css" /> <div class="container-fluid"> <div class="panel panel-default crd-dsgn-prt"> <div class="panel-heading">Delete Users</div> <div class="panel-body"> <form method="post"> <fieldset class="fld-sec-prt"> <legend style="width:auto; padding-left: 20px;padding-right:20px;">Users Details</legend> <div class="row"> <div class="col-lg-6 col-sm-6 col-md-6"> <div class="wrap-input2 validate-input" data-validate="Name is required"> <input type="text" class="input2" id="user_name" name="user_name"> <span class="focus-input2" data-placeholder="User Name"></span> </div> </div> <div class="col-lg-6 col-sm-6 col-md-6"> <div class="wrap-input2 validate-input" data-validate="Name is required"> <input type="email" class="input2" id="user_email" name="user_email"> <span class="focus-input2" data-placeholder="User Email"></span> </div> </div> <div class="col-lg-6 col-sm-6 col-md-6"> <div class="wrap-input2 validate-input" data-validate="Name is required"> <input type="password" class="input2" id="user_password" name="user_password"> <span class="focus-input2" data-placeholder="User Password"></span> </div> </div> <div class="col-md-12 col-sm-12 col-lg-12"> <div class="checkbox" id="setPrivilege"> <label><input type="checkbox" required> Set Privilege</label> </div> <table id="notificationsTableId" style="width:100%;"> <thead> <tr role="row"> <th rowspan="1" colspan="1" aria-label="" align="center"> <label><input type="checkbox" id="selectall">Select all</label> </th> </tr> </thead> <?php $controllers=$this->config->item('checkControllers'); foreach ($controllers as $controller): setPrivilege($controller); endforeach; ?> <tbody role="alert"> <?php function setPrivilege($name) { ?> <tr class="results-table-row"> <td style="text-transform: capitalize"><?php echo $name; ?></td> <td><label><input type="checkbox" class="selectedId" value="1" name="<?php echo $name; ?>"> view</label></td> <td><label><input type="checkbox" class="selectedId" value="2" name="<?php echo $name; ?>"> add/update</label></td> <td><label><input type="checkbox" class="selectedId" value="3" name="<?php echo $name; ?>"> delete</label></td> </tr> <?php } ?> </tbody> </table> </div> </div> </fieldset > <div class="txt-cntr"><button type="submit" class="btn-prt-sec btn--1"><span class="btn__text">Delete</span></button></div> </form> </div> </div> </div> <script> $("#setPrivilege").on('click', function () { }); $('#setPrivilege').click(function () { if (this.checked) { alert('checked'); } }); </script> <script type="text/javascript"> $(document).ready(function () { $('#selectall').click(function () { $('.selectedId').prop('checked', this.checked); }); $('.selectedId').change(function () { var check = ($('.selectedId').filter(":checked").length == $('.selectedId').length); $('#selectall').prop("checked", check); }); }); </script>