JSFiddle - React, Tailwind, and code Playground
HTML
<p id="test">test</p>
JavaScript
var MyObj = function(obj) {
this.obj = obj;
};
MyObj.prototype.bg = function (color) {
var id = this.obj;
if (id[0] == '#') {
id = id.slice(1);
}
var a = document.getElementById(id);
a.innerText = color;
return this;
};
var $ = function (id) {
return new MyObj(id);
};
$('#test').bg('0xFF0000').bg('green');