JSFiddle - React, Tailwind, and code Playground

by hiteshubharani

HTML

<div id="parent">
    <div id="test"></div>
</div>

CSS

#test
{
    background:black;
    width:20px;
    height:20px;
}

#parent
{
    position:relative;
    width:100%;
    height:100%; 
    background:#eee;
}

JavaScript

$.widget("ui.staticTest", {
    staticVar: 'unchanged',
    _create: function() {

    },
    test: function(a) {
        if (a) {
            //alert(typeof $.ui.staticTest.staticVar);
            $.ui.staticTest.staticVar = a;
        } else {
            alert(JSON.stringify($.ui.staticTest.staticVar));
        }
    }
});


$('#test').staticTest();
$('#parent').staticTest();

$('#test').staticTest('test', 'changed');
$('#parent').staticTest('test');