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
(function init(){
registerEvents();
})();
function notify(declim) {
if ($.isNumeric(declim)) {
//stuff
} else {
declim = 10;
}
$("#container").html("<div id='1'>Text1</div><div id='2'>Text2</div>");
alert(declim);
}
function registerEvents() {
$('body').on('click', '#1', function (event) {
event.stopPropagation();
var declim = 10 - 1;
notify(declim);
});
$('body').on('click', '#2', function (event) {
event.stopPropagation();
var declim = 10 + 1;
notify(declim);
});
$('body').on('click', '#2', function (event) {
event.stopPropagation();
var declim = 20 + 1;
notify(declim);
});
}