I am new in PHP. I want to create a script to Check All Check Boxes, But I am Failed.
Here is My output
I want that when i check Check-box Under Opinion Column it select all Check-Box of this row.
Here is My Code
JavaScript:
<script>
$('.allcb').on('click', function(){
$(this).parent().parent().parent().parent().find('.chk').prop('checked', this.checked);
});
</script>
HTML:
<input type="checkbox" name="opinion[]" class="allcb" data-child="chk" value="<?php echo $opinion[$i]?>" /> <?php echo $opinion[$i]?>
</td>
<td><input type="checkbox" name="action[]" class="chk" value="<?php echo $action[$i] ?>"/><?php echo $action[$i] ?></td>
<td><input type="checkbox" name="long_term[]" class="chk" value="<?php echo $long_term[$i] ?>" /> <?php echo $long_term[$i] ?> </td>
<td><input type="checkbox" name="p_long_term[]" class="chk" value="<?php echo !empty($p_long_term[$i])?$p_long_term[$i]:'';?>"/>
<?php echo !empty($p_long_term[$i])?$p_long_term[$i]:'';?>
</td>
<td><input type="checkbox" name="short_term[]" class="chk" value="<?php echo $short_term[$i] ?>"/> <?php echo $short_term[$i] ?></td>
<td><input type="checkbox" name="p_short_term[]" class="chk" value="<?php echo !empty($p_short_term[$i])?$p_short_term[$i]:'';?>" />
<?php echo !empty($p_short_term[$i])?$p_short_term[$i]:'';?></td>
<td><input type="checkbox" name="outlook[]" class="chk" value="<?php echo $outlook[$i] ?>"/><?php echo $outlook[$i] ?></td>
<td><input type="checkbox" name="rating_type[]" class="chk" value="<?php echo $rating_type[$i] ?>"/><?php echo $rating_type[$i] ?></td>
Aucun commentaire:
Enregistrer un commentaire