JSFiddle - React, Tailwind, and code Playground

by sarathsprakash

HTML

<table class="fullTable">
    <tr class="listTableTr">
        <th class="listTableTh tinyTh"><input type="checkbox" name="" id="checkAll" /></th>
        <th for="checkAll" class="listTableTh">title</th>

    </tr>

  
<tr>
        <td class="listTableTd"><input type="checkbox"  name="" class="checkboxes" /></td>
        <td class="listTableTd"><a href="<?php echo 'index.php?r=admin/post/edit&post='.$post['id']; ?>"><?php echo $post['title'];?></a></td>
    </tr>
          <tr>
        <td class="listTableTd"><input type="checkbox"  name="" class="checkboxes" /></td>
        <td class="listTableTd"><a href="<?php echo 'index.php?r=admin/post/edit&post='.$post['id']; ?>"><?php echo $post['title'];?></a></td>
    </tr>                 

</table>

JavaScript

$("#checkAll").click(function () {
    if ($(this).is(":checked")) 
    $(".checkboxes").prop("checked","checked");
    else
         $(".checkboxes").prop("checked",false);
});