JSFiddle - React, Tailwind, and code Playground

by lbstr

HTML

<a href="javascript:;" data-tabkey="~/asdf/qwerty.cshtml">qwerty</a>
<div data-tabkey="~/asdf/qwerty.cshtml">qwerty</div>

CSS

div { display: none; color: blue; font-size: 20px; }

JavaScript

$('a').click(function(){
    var $this = $(this),
        key = $this.data('tabkey'),
        $target = $('div[data-tabkey="'+key+'"]');
    
    if ($target.length) {
        if ($target.is(':visible')) {
            $target.fadeOut();
        }
        else {
            $target.fadeIn();
        }
    }
    else {
        alert('no target found for ' + key);
    }
});