JSFiddle - React, Tailwind, and code Playground
by lollero
HTML
<a href="#" title="TEST">This is a test.</a>
JavaScript
var attrTitle = $('a').attr('title');
console.log( attrTitle )
$('a').on("mouseenter mouseleave mousedown", nativeTooltip);
function nativeTooltip(e) {
// Check for event type.
// If event is mouseenter, remove title.
if ( e.type === 'mouseenter' ) {
$('a').removeAttr('title');
}
// If event mouseleave or click, give the title back.
// The reason for click event bringing the title back is that
else {
$('a').attr('title', attrTitle);
}
}
$('a').on("click", function() {
console.log( $(this).attr('title') )
});