JSFiddle - React, Tailwind, and code Playground

by Riccal

HTML

<button class='show_hide'>show / hide</button>
<div class="slidingDiv">Hello</div>

JavaScript

$('.slidingDiv').hide();
$('.show_hide').click(function(e){ // <----you missed the '.' here in your selector.
    e.stopPropagation();
    $('.slidingDiv').slideToggle();
});
$('.slidingDiv').click(function(e){
    e.stopPropagation();
});

$(document).click(function(){
     $('.slidingDiv').slideUp();
});