I have some data from my mysql database. I am showing that data in table using foreach loop like below
<table>
foreach($students as $row):?>
<tr><td><i id="expand<?php echo $row['student_id'];?>" class="myclass fa fa-plus-square"></i></td>
<td><?php echo $i; $i++;?></td>
<td><?php echo $row['roll'];?></td>
<td style="text-align:center;"><img src="<?php echo $this->crud_model->get_image_url('student',$row['student_id']);?>" class="img-circle" width="50" /></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['address'];?></td>
<td><?php echo $row['phone'];?></td></tr></table>
I have also a click event function in Javascript like below
$('#expand').click(function(){
$('#dev').toggleClass('hidden');
});
This is I want to hide and show on clicked event. Please note that this row contains data of student whose student id is $row['student_id']
<tr id="dev<?php echo $row['student_id'];?>" class="hidden">
<td colspan="7">
<table>
<tr><td>Phone Number is <?php echo $row['phone'];?></td></tr>
</table>
</td>
</tr>
I want to pass element id from php to javascipt so that when clicked on id expand it will execute some function like showing or hiding
Thanks.