JSFiddle - React, Tailwind, and code Playground

by jfriend00

HTML

<div id="result"></div>

CSS

.test {color: red;}

JavaScript

function $$(elem) {
    if (!(this instanceof $$)) {
        return(new $$(elem));
    } else {
        this.elem = elem;
    }
}

$$.prototype = {
    set: function(prop, value) {
        this.elem[prop] = value;
        return(this);
    }
};


$$(document.getElementById("result")).set("innerHTML", "xxxx").set("className", "test");