JSFiddle - React, Tailwind, and code Playground
HTML
<a href="javascript:void(0);" data-id="1" id="name">Show Name</a>
JavaScript
$('a').on('click', fnShowHide);
function fnShowHide() {
var $this = $(this);
iCol = $this.data('id');
$this.text(function (i, txt) {
return txt === 'Show Name' ? 'Hide Name' : 'Show Name';
});
}