JSFiddle - React, Tailwind, and code Playground
by Twisty
HTML
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.</p>
<p>But as it's not a native tooltip, it can be styled. Any themes built with
<a href="http://jqueryui.com/themeroller/" title="ThemeRoller: jQuery UI's theme builder application">ThemeRoller</a> will also style tooltips accordingly.</p>
<p>Tooltips are also useful for form elements, to show some additional information in the context of each field.</p>
<p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes."></p>
<p>Hover the field to see the tooltip.</p>
<button id="show-diag-btn">Show Dialog</button>
<div class="dialog" title="Modal Dialog Box">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;" title="Modal Alert Tooltip"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>
CSS
label {
display: inline-block;
width: 5em;
}
JavaScript
$(function() {
$(document).tooltip();
$(".dialog").dialog({
autoOpen: false,
resizable: false,
height: "auto",
width: 400,
modal: true,
buttons: {
"Delete all items": function() {
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
$("#show-diag-btn").click(function() {
$(".dialog").dialog("open");
})
});