Reputation: 6471
I load the text for the tooltip from a custom tag, data-tooltip. I'd like the tooltip to be hidden if the data-tooltip is not present. Is this possible?
Example jsfiddle
Upvotes: 0
Views: 1885
Reputation: 50905
Try this:
$(document).ready(function() {
$('#menu a').qtip({
content: {
attr: "data-tooltip"
}
});
});
The qtip2 documentation says this for using "text" instead of "attr":
Custom functions that return no valid content will still cause the tooltip to be created! Replace these with an each() loop if this is not the desired behaviour.
If you look at the use of "attr", it says:
If no valid content is found within the elements attribute, and content.text is not defined, no tooltip will be rendered.
Upvotes: 2