I have a table and for one column I want to have a tooltip in each row. So all cells in one column have specific class, 'cell1' so I made tooltip with jquery:
$(table).uitooltip({
items: 'cell1',
content: 'some content'
});
What I want to do is to not show the tooltip in case the cell value is empty. So
$('.cell1').html() == ""
Is it possible to show jquery tooltip only in some cases?
To achieve this provide a function to content
which returns the text to be shown in the tooltip. In cases where you do not want to show the tooltip at all, return null
.
$(table).uitooltip({
items: 'cell1',
content: function() {
return $(this).html().trim() !== '' ? 'some content' : null;
}
});