JSFiddle - React, Tailwind, and code Playground

by Timmy Willison

HTML

<p id="test">Testing 1, 2, 3</p>
<button id="toggle">show/hide</button>

CSS

#toggle {
    position: absolute;
    top: 100px;
    left: 20px;
    width: 100px;
}

JavaScript

$('#toggle').click(function() {
    var $test = $('#test').stop(true, true);
    if ( $test.css('display') === "none" ) {
        $test.show(400, function() {
            $test.removeAttr('style');
            console.log( $test.attr('style') );
        });
    } else {
        $test.hide(400);
    }
});