JSFiddle - React, Tailwind, and code Playground

by adeneo

HTML

<div id="title">click</div>

JavaScript

var $ = function(selector, context) {
    if (this instanceof $) {
        
        this[0] = document.querySelector(selector),
        this.context = context || document
        return this;
        
    }else{
        
        return new $(selector, context);
        
    }
}

$.prototype.css = function(style, value) {
    this[0].style[style] = value;
}


$('#title').css('color', 'red');