JSFiddle - React, Tailwind, and code Playground

by hollandben

HTML

<p>This is some <span class="tooltip">random</span> text where hopefully, there <span class="tooltip">will</span> be a pop up window pop up when a certain word is <span class="tooltip">hovered</span> over. Hmmm, we'll see if it works...</p>

CSS

span.tooltip {
    text-decoration:underline;
}
div.popup {

JavaScript

$(document).ready(function(){
    
    $('span.tooltip').hover(function(){
        var text = $(this).text();
        $popup = '<div class="popup">'+text+'</div>';
        $('body').append($popup);
    }, function(){
        $popup.remove();
    });
    
});