JSFiddle - React, Tailwind, and code Playground

HTML

<div id="yo"></div>

JavaScript

function Creator()
{
    var c1 = new Child();
    c1.SetName("Albert");
    c1.SetStandardClickHandler();  
    
    var c2 = new Child();
    c2.SetStandardClickHandler();  
    c2.SetName("Sarah");
    
    $("#yo").append(c1._layout);
    $("#yo").append(c2._layout);
}

Child.prototype = new Button();

function Child()
{
    this._layout = $('<div>child</div>');
}

function Button()
{
    var that =  this;
    var _name;
    
    this.SetName = function(name)
    {
        _name = name;
    }
    
    this.SetStandardClickHandler = function()
    {
        this._layout.click(function()
        {
            alert(_name);
        });
    };

}

var c = new Creator();