JSFiddle - React, Tailwind, and code Playground
HTML
<div id="box">
</div>
CSS
#box{
height: 200px;
width: 200px;
background-color: black ;
}
JavaScript
var count = 0;
$('body').delegate('#box','click',function(e){
var bar = 'bar --- default value';
count++;
if( count === 1 ){
bar = 'bar ---- first click';
console.log( bar );
}
else if( count === 2 ){
console.log( bar );
}
$(this).fadeOut(5000);
});