JSFiddle - React, Tailwind, and code Playground

by Roger Ramos

HTML

<div></div>
<button onclick="javascript:$('div').esconde()">esconde</button>

CSS

div {
    background:red;
    padding:50px
}

JavaScript

(function () {
    var blJs = function (arg) {
        if (!(this instanceof blJs)) {
            return new blJs(arg);
        }

        this.myArg = arg;
    };

    blJs.fn = blJs.prototype = {
        esconde: function () {
            var obj = document.querySelector(this.myArg);
            if (obj.style.display != 'none') {
                obj.style.display = 'none';
            } else {
                obj.style.display = '';
            }
        }
    };

    window.blJs = blJs, window.$ = blJs;
})();