JSFiddle - React, Tailwind, and code Playground
HTML
<div class="cal_event">1</div>
<div class="cal_event">2</div>
<div class="cal_event">3</div>
<div class="table">Показать</div>
<div id="res">resultat</div>
CSS
div{cursor: pointer;}
JavaScript
(function ($) {
var $res = $('#res');
$(".cal_event").on("click", function(event) {
var calEvent = event.target;
$res.text( '1: ' + $(calEvent).text() );
$(".table").on("click", function(e) {
calEvent = $(this).text();
$res.text('2: ' + calEvent);
});
});
})(jQuery);