JSFiddle - React, Tailwind, and code Playground
HTML
<a id="aTag" href="javascript:toggleAndChangeText();">
HIDE
</a>
<div id="divToToggle">
Content that will be shown or hidden.<strong>
</div>
JavaScript
function toggleAndChangeText() {
$('#divToToggle').slideToggle(function() {
if ($('#divToToggle').is(':visible')) {
$('#aTag').html('HIDE');
}
else {
$('#aTag').html('SHOW');
}
});
}