JSFiddle - React, Tailwind, and code Playground

HTML

<div class="wrapper">
<div class="container1">
This is the Element i want to toggle
</div>
<div class="container2">
<a href="#" class="button">Click</a>
</div>
</div>

JavaScript

$("a").on("click",function(e){
 var el=$(this); // this will be a element
 el.parents(".wrapper").find(".container1").toggle();
})