JSFiddle - React, Tailwind, and code Playground

by Laxmikant Dange

HTML

<button id='btnAdd'>Add</button>
<button id='BtnRemove'>Remove</button>

JavaScript

var obj = {

        get el () {
            return document.querySelector("#list");
        }
}

$('#btnAdd').on('click',function(){
	$("<div>",{id : "list"}).html("hello").appendTo("body");
    console.log('After Adding',obj.el);
});

$('#BtnRemove').on('click',function(){
	$("#list").remove();
    console.log('After removal',obj.el);
});