Live Demo
Hover the icon below to see a real, styled jQuery UI tooltip with custom content.
Hover the icon
Tooltip not shown yet.
jQuery UI's tooltip() widget upgrades a plain browser title tooltip into a styled, positionable popup. Attach it to any element that already has a title attribute, or feed it custom HTML content, and control exactly where and how it appears.
| Option / Event | Description | Example |
|---|---|---|
.tooltip() | Converts an element's title attribute into a styled tooltip. | $('[title]').tooltip(); |
content | Supplies custom HTML content instead of the plain title text. | content: function(){ return '<b>Hi</b>'; } |
position | Controls where the tooltip appears relative to the element. | position: { my: 'left+15 center', at: 'right center' } |
show / hide | Fire when the tooltip opens/closes; can animate. | show: { effect: 'fadeIn', duration: 200 } |
title attribute on your markup as a fallback for screen readers and non-JS environments — tooltip() reads it, it doesn't remove its accessibility value.title)
// <button title="Saves your changes">Save</button>
$('[title]').tooltip();
content Option (Custom HTML)
$('#info').tooltip({
content: function(){
return '<strong>Note:</strong> Free shipping over $50';
}
});
position Option
$('#info').tooltip({
position: { my: 'left+15 center', at: 'right center' }
});
show / hide Events
$('#info').tooltip({
show: { effect: 'fadeIn', duration: 200 },
hide: { effect: 'fadeOut', duration: 150 }
});
Hover the icon below to see a real, styled jQuery UI tooltip with custom content.
Hover the icon
click handler so the info is reachable without a mouse.