JSFiddle - React, Tailwind, and code Playground

by Rajesh Dixit

HTML

<body>
    <container>
        <div id='1'>Text1</div>
        <div id='2'>Text2</div>
    </container>
</body>

CSS

div {
    width:100px;
    margin:10px;
    background:#E9E9E9;
    border:1px solid silver;
    padding:1%;
    text-align:center
}

JavaScript

var count = 0;

$(function notice_it(declim, incr) {    
    if ($.isNumeric(declim)) { 
        //stuff
    } else {
        declim = 10;
    }
    $("#container").html("<div id='1'>Text1</div><div id='2'>Text2</div>");
    alert(declim + " " + incr);


$('body').on('click', '#1', function (event) {
    var iteration = "Iteration: "+ count++;
    event.stopPropagation();
    var declim = 10 - 1;
    notice_it(declim, iteration);
});

$('body').on('click', '#2', function (event) {
    var iteration = "Iteration: "+ count++;
    event.stopPropagation();
    var declim = 10 + 1;
    notice_it(declim, iteration);
});


$('body').on('click', 'body', function (e) {
    e.stopPropagation();
});

});