Home > Back-end >  Primefaces Tooltip remove title
Primefaces Tooltip remove title

Time:06-02

I am using a Primefaces Global Tooltip. I set the title during runtime.

Apparently the title is deleted by Primefaces and stored in data. Got this code from Primefaces on Github.

var title = element.attr('title');
if (title) {
   element.data('tooltip', title).removeAttr('title');
}

My question now is how can I stop showing the tooltip for certain elements? Tried to overwrite the title attribute on runtime with an empty value. But this not working, since primefaces check for if (title).

My Case:

  1. Show an tooltip if the elment has an overflow. (Already working)

  2. Don´t show the tooltip if the element has no overflow. (Working partly) - if the tooltip was shown once, there is no way to stop showing it. Since the title value get saved somewhere else. Where to replace it with null or an empty string?

CodePudding user response:

Your best option here is to use the globalSelector attribute. It is a jQuery selector for the global tooltip and defaults to a,:input,:button. So you can narrow down on what elements the global tooltip is applied.

See also:

CodePudding user response:

Found out how to access the tooltip value.

$(element).data('tooltip')

Tried before:

element.data('tooltip');

Which not worked.

  • Related