點擊鏈接我有這樣檢查複選框jQuery中
用戶名與數組來和0-8其他值不同的陣列來應用視圖。
<table class="table">
<thead>
<tr>
<th width="60%">Name</th>
<th>View</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php $x = 0; ?>
<?php foreach ($users as $user) { ?>
<tr>
<th style="background-color: #cce5ff;"> <a style="color:#8c8c8c; cursor: pointer;" type="button" data-toggle="collapse" data-target="#<?php echo $user['user']->id; ?>_<?php echo $x; ?>">
<b><?php echo $user['user']->first_name . " " . $user['user']->last_name; ?></b></a>
</th>
<th colspan="3" style="background-color: #cce5ff;"><a id="<?php echo $user['user']->id; ?>" class="select_all user_<?php echo $user['user']->id; ?>" style="cursor: pointer;">Select All</a> </th>
</tr>
<tbody id="<?php echo $user['user']->id; ?>_<?php echo $x; ?>" <?php if($x != 0){?> class="collapse"<?php } ?>>
<?php foreach ($folders as $folder) {
$user_permissions = get_folder_permission($user['user']->id,$folder->id);
?>
<tr>
<td>
<?php echo $folder->client_name;?>
</td>
<td>
<input type="checkbox" id="view_<?php echo $folder->id; ?>_<?php echo $user['user']->id; ?>" class="is_check_v check_all_<?php echo $user['user']->id; ?>" value="view" <?php if(isset($user['permission'])){if(!empty($user_permissions) && $user_permissions->can_view==1){ echo 'checked';}else{echo '';}}?> name="per">
<input type="hidden" id="h_view_<?php echo $folder->id; ?>_<?php echo $user['user']->id; ?>" name="view_permission[][<?php echo $folder->id; ?>][<?php echo $user['user']->id; ?>]" value="<?php if(!empty($user_permissions)){ echo $user_permissions->can_view;}else{ echo 0; } ?>">
</td>
<td>
<input type="checkbox" id="edit_<?php echo $folder->id; ?>_<?php echo $user['user']->id; ?>" class="is_check_e check_all_<?php echo $user['user']->id; ?>" value="edit" <?php if(isset($user['permission'])){if(!empty($user_permissions) && $user_permissions->can_edit==1){ echo 'checked';}else{echo '';}}?> name="per">
<input type="hidden" id="h_edit_<?php echo $folder->id; ?>_<?php echo $user['user']->id; ?>" name="edit_permission[][<?php echo $folder->id; ?>][<?php echo $user['user']->id; ?>]" value="<?php if(!empty($user_permissions)){ echo $user_permissions->can_edit;}else{ echo 0; } ?>">
</td>
<td>
<input type="checkbox" id="delete_<?php echo $folder->id; ?>_<?php echo $user['user']->id; ?>" class="is_check_d check_all_<?php echo $user['user']->id; ?>" value="delete" <?php if(isset($user['permission'])){if(!empty($user_permissions) && $user_permissions->can_delete==1){ echo 'checked';}else{echo '';}}?> name="per">
<input type="hidden" id="h_delete_<?php echo $folder->id; ?>_<?php echo $user['user']->id; ?>" name="delete_permission[][<?php echo $folder->id; ?>][<?php echo $user['user']->id; ?>]" value="<?php if(!empty($user_permissions)){ echo $user_permissions->can_delete;}else{ echo 0; } ?>">
</td>
</tr>
<?php } ?>
</tbody>
<?php $x++; ?>
<?php } ?>
</tbody>
我要檢查所有的「查看」,「編輯」,「刪除」複選框後單擊「全選」鏈接。 每個用戶都有「全選」鏈接,如果點擊它,只有他的複選框被選中。這是我想要做的,但我沒有任何想法去做。
我想用Jquery來做。
請任何幫助。
請不要發佈裸露代碼的答案,也提供了一些關於你的代碼在做什麼的評論。 –