Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap Tooltip Data-selector?

What is the data-selector option used for in Twitter's Bootstrap Tooltip? The description reads...

If a selector is provided, tooltip objects will be delegated to the specified targets.

But I don't understand its purpose or how to use it.

like image 460
Adam Youngers Avatar asked Nov 24 '12 20:11

Adam Youngers


People also ask

How do I show data in tooltip?

Basic Tooltip HTML: Use a container element (like <div>) and add the "tooltip" class to it. When the user mouse over this <div>, it will show the tooltip text. The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" .

How do I use data toggle tooltip?

To create a tooltip, add the data-toggle="tooltip" attribute to an element. Note: Tooltips must be initialized with jQuery: select the specified element and call the tooltip() method.

Are Bootstrap tooltips accessible?

Bootstrap's interactive components—such as modal dialogs, dropdown menus and custom tooltips—are designed to work for touch, mouse and keyboard users.

Can tooltips be clickable?

As we mentioned in the preamble, tooltips are completely "mute" to any interactions as to not steal hover events from elements underneath them. Even placing interactive elements, such as links, into content of tooltip will not work.


1 Answers

It is the similar to using jQuery delegation methods like on() or delegate() in order to account for tooltip elements that aren't present in page when code is run.

Example binding to body since it is always present in page

$('body').tooltip({
   selector: '.mytooltipClass'

})
like image 177
charlietfl Avatar answered Sep 21 '22 05:09

charlietfl