JSFiddle - React, Tailwind, and code Playground

by Alexey Ukolov

HTML

<div class="title">Test</div>

JavaScript

class TotallyNotAjQuery {
    constructor() {
        this.inf = {
            $el: null
        }
        this.el = this.el.bind(this);
    }
    el(selector) {
        this.inf.$el = document.querySelector(selector);
        return this;
    }
    styles(stylesObj) {
        for(const primary in stylesObj) {
            this.inf.$el.style[primary] = stylesObj[primary];
        }
        return this
    }
    on(event, func) {
        this.inf.$el.addEventListener(event, func);
        return this;
    }
}

const {el: $} = new TotallyNotAjQuery();

$(".title").styles({
    color: "red"
}).on("click", () => {
    console.log("click");
});