JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btn">press me</button>
<div id="tt">tooltip</div>
CSS
#tt {
background-color: red;
width: 50px;
height: 50px;
display: none;
}
JavaScript
(function($){
$.event.special.destroyed = {
remove: function(o) {
if (o.handler) {
o.handler()
}
}
}
})(jQuery)
$('#btn').on('mouseover', function() {
$('#tt').show();
}).on('mouseleave', function() {
$('#tt').hide();
}).on('click', function() {
$(this).remove();
}).on('destroyed', function() {
$('#tt').hide();
})