JSFiddle - React, Tailwind, and code Playground
HTML
<div class="button" onclick="done('david','33');">click</div>
<div class="info-holder"></div>
<div class="info"></div>
CSS
.info {
display:none;
background: rgba(0,0,0,.4);
width: 400px;
height: 100px;
margin: 50px auto;
padding: 15px;
}
.button {
width: 40px;
height: 20px;
background:red;
cursor:pointer;
}
.jj {
width: 120px;
height: 80px;
background:gray;
color:white;
cursor:pointer;
}
JavaScript
var done = function (a, b) {
var jj = $("<div/>", {
'class': 'jj',
'data-age': b,
'data-name': a,
'html': b
}).appendTo($(".info-holder"));
jj.on('click', function () {
$('div.info').html(
'name : ' + jj.attr('data-name') + ' age: ' + jj.attr('data-age')
).fadeIn();
});
};