jQuery UI Tooltip

Overview

Tooltip replaces native tooltips, making them themable as well as allowing various customizations: Display other content then just the title, like inline footnotes or extra content retrieved via ajax; customize the positioning, eg. to center the tooltip above elements; add extra classes to customize the appearance, for warning or error fields.

A fade animation is used to show and hide the tooltip, making the appearance a bit more organic, compared to just toggling the visiblity.

Dependencies

  • UI Core
  • UI Widget
  • UI Position

Example

Apply the widget to all elements with a title attribute.

$("[title]").tooltip();

<!DOCTYPE html>
<html>
<head>
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
  
  <script>
  $(document).ready(function() {
    $("[title]").tooltip();
  });
  </script>
</head>
<body style="font-size:62.5%;">
  <a href="#" title="Anchor description">Anchor text</a> 
<input title="Input help" />

</body>
</html>

Options

Events

Methods

Theming

The jQuery UI Tooltip plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain.

If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.tooltip.css stylesheet that can be modified. These classes are highlighed in bold below.

Sample markup with jQuery UI CSS Framework classes

<div class="ui-tooltip ui-widget ui-corner-all ui-widget-content" id="ui-tooltip-0">
  <div class="ui-tooltip-content">
    tooltip content
  </div>
</div>

Note: This is a sample of markup generated by the tooltip plugin, not markup you should use to create a tooltip. The only markup needed for that is an elemenet with a title attribute.