Saturday, May 23, 2015

Check all check boxes javascript

<table>
<thead>
    <tr>
<th><input id="check_all" class="formcontrol" type="checkbox"/></th>
            </tr>
 </thead>
  <tbody>
<tr>
<td><input class="case" type="checkbox"/></td>
</tr>
  </tbody>
</table>

<script type="text/javaScript">
//to check all checkboxes
$(document).on('change','#check_all',function(){ $('input[class=case]:checkbox').prop("checked", $(this).is(':checked')); });
</script>

No comments:

Post a Comment

Total Pageviews