JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#" class="show" data-show="first">SHOW</a>
<a href="#" class="show" data-show="second">SHOW</a>
<div id="first">First paragraph.</div>
<div id="second">Second paragraph</div>
CSS
div {
display: none;
}
JavaScript
jQuery(".show").live("click", function (e) {
var slide = '#' + jQuery(this).data('show');
jQuery(slide).slideToggle();
e.preventDefault();
});
//i need to use live() as this is just a snippet from a bigger project ('show' links are generated via php and are a part of dynamic jquery slider)