Suppose we have a page with some text written in, which also contains a few links to both internal pages (that is, pages on the same server) and external websites.
We are presented with different choices in terms of which elements to apply the tooltip to (referring to links as an example, but they apply to any kind of element as well), as follows:
All the links
All the links with a specific class (for example,
tooltip
)All the links with the title attribute not empty
All the links pointing to internal pages
All the links pointing to external websites
Combinations of the above
We can easily combine the first three conditions with the others (and with themselves) using CSS selectors appropriately. For example:
$("a")
, all the links$("a.tooltip")
, links having atooltip
class$("a[title]")
, links with atitle
attribute (still have to check if empty)$("a.tooltip[title]")
, links with atooltip
class and atitle
attribute
As for internal and external pages, we have to work with...