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.
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"> ...