JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tbody class="iteration">
<tr>
<td>
<button class="save">More</button>
</td>
<td>
<div class="cruisedropd">
<div class="loading"></div>
</div>
</td>
</tr>
</tbody>
<tbody class="iteration">
<tr>
<td>
<button class="save">More</button>
</td>
<td>
<div class="cruisedropd">
<div class="loading"></div>
</div>
</td>
</tr>
</tbody>
</table>
JavaScript
$(function() {
$(".cruisedropd").hide();
$('.save').click(function() {
var parent = $(this).closest("tbody.iteration");
parent.toggleClass('is_loading', parent.hasClass('is_loading'));
parent.find(".cruisedropd").toggle();
parent.find('.loading').html("work");
$(this).text(function(_, text) {
return text == "More" ? "Hide" : "More";
});
});
});