简体   繁体   中英

Primefaces Tooltip remove title

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?

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:

Found out how to access the tooltip value.

$(element).data('tooltip')

Tried before:

element.data('tooltip');

Which not worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM