JSFiddle - React, Tailwind, and code Playground
HTML
<div id="collapse1">
content
</div>
<a href="#collapse1" class="nav-toggle">Hide</a>
JavaScript
$('.nav-toggle').click(function()
{
var txtValue = $('.nav-toggle').text();
alert(txtValue)
$('#collapse1').toggle('fast');
if(txtValue = 'Hide'){$('.nav-toggle').html('Show');}
else if(txtValue = 'show'){
$('.nav-toggle').text('Hide');}
});