JSFiddle - React, Tailwind, and code Playground

HTML

<div class="testSpanDiv"></div>

CSS

#testSpan{
width:100px;
height:100px;
display:inline-block;
border:1px solid red;
cursor:pointer
}

JavaScript

$(document).ready(function () {
      $('.testSpanDiv').append('<span id="testSpan">Hello</span>');
  })

  $('body').on('click', '#testSpan', function(){
      alert("Hello")
  });