JSFiddle - React, Tailwind, and code Playground

by anton4ept

HTML

<div id="board"></div>

JavaScript

class Ceil {
    constructor(x, y) {
        this.x = x;
        this.y = y;
        this.el = document.createElement("div", {className: "cell cell_white x_"+this.x+" y_"+this.y, id: "cell_"+this.x+"_"+this.y });
        
    }
    fullName() {
        return 'hello it x ' + this.x;
    }
    getEl() {
    	return this.el
    }
}
var x = 10;
var y = 20;
var ceil_el = new Ceil(x, y);
var board = document.querySelector("#board");
board.appendChild(ceil_el.getEl())
ceil_el.el.innerHTML = "что хотите";
console.log(ceil_el.el, ceil_el.el.innerHTML);