JSFiddle - React, Tailwind, and code Playground

HTML

<div id="1" style="width:100px; height:100px; background-color:green;"></div>
<div id="2" style="width:100px; height:100px; background-color:red;"></div>

JavaScript

// Повесь код выполнятся после события domready
// jquery
$(function(){
    var s = $("#1");
    s.on("click", function(){alert('hello 1');});
});

// vanilla (без учета IE разумеется)
document.addEventListener('DOMContentLoaded', function() {
  var s = document.getElementById('2');
  s.addEventListener('click', function(){alert('hello 2');});
})