JSFiddle - React, Tailwind, and code Playground

by alzclarke

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", {
    _create: function(){
        this.staticVar={val:'unchanged'};
    },
    test: function(a){
        if(a){
            this.staticVar.val= a;
        }
        alert(JSON.stringify(this.staticVar.val));
    }
});


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

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