I'm generating a table via SQL/php. It outputs one .data-row and one .admin-row in each loop. When I click the edit icon <i class='edit-button'></i>, I only need it to open the next .admin-row right below the that the edit icon is in (screenshot).
Right now, I am using this jQuery code which opens all .admin-row class elements.
$('.edit-button').click(function() {
$('#dataTable').find('.admin-row').toggleClass('d-none');
});
I've experimented with .next(), .parent(), .find() but can't get it to open only the next .admin-row after the edit button.
<?php
<table> ... / table head...
foreach($result as $row) {
echo "<tr class='data-row'>";
echo "<td>".$date_form."</td>
echo "<td>".$time_form."</td>
echo "<td>".$subject_form."</td>
echo "<td>".$public."</td>
if ($userUid == "admin") {
echo "<td><i class='edit-button'></i></td>";
}
echo "</tr>";
if ($userUid == "admin") { ?>
<tr class='admin-row'>
<form action="includes/update.inc.php" type="post">
<td><input name="editId" type="text"></td>
<td class='p-2' colspan="4">
<textarea name="editContent" type="text"></textarea>
</td>
<td><button name="submit-edit" type="submit">EDIT</button></td>
</form>
</tr>
<?php }}?>
</table>
