JSFiddle - React, Tailwind, and code Playground

HTML

<span title="abc">def</span>

CSS

span {
    position: relative;
}
span.show-title:after {
    content:attr(title);
    padding:5px;
    border:1px solid #ccc;
    top:5px;
    right:10%;
    background: #bada55;
}

JavaScript

$(document).ready(function() {
  
  $('span').click(function() {
    
    $(this).toggleClass('show-title');
  });
});