O'Reilly logo

jQuery UI Cookbook by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using custom markup in tooltips

We're not limited to using the title attribute to supply basic text strings to the tooltip content. Sometimes, the content of the tooltip widget warrants formatting. For example, a title section would have different font styles than that of the main text section. The tooltip widget allows developers to pass in custom content through the content option. This can either be a raw string, or a function that returns the content we would like displayed. Let's look at how to go about using this option in your application.

How to do it...

We'll create two button elements; each have a title attribute, the text of which we'll use in the tooltip. We're also going to add the name of the button as the tooltip title.

<div class="button-container"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required