I've got a table with multiple rows. In each row is a Show Details Button and a Hide Details button. On clicking show details I want the hide details button to only show for the specific row. I thought the .closest() function would work but it hasn't yet.
Here is the HTML
<table>
<tr id="1">
<td><button class='view'>View Details</button><button class='hide' style='display:none;'>Hide Details</button></td>
</tr>
<tr id="2">
<td><button class='view'>View Details</button><button class='hide' style='display:none;'>Hide Details</button></td>
</tr>
</table>
Here is the jQuery
$(".view").click(function() {
$("#patient").show("");
$(this).hide();
$(this).closest(".hide").show();
});