Gravatar for

Question by PPatil3, Dec 4, 2018 6:05 AM

How we show our customize tooltip on facet without using facet Id?


i am using following code.

Coveo.$$(root).on('afterInitialization', function () {
  var facetTitleElement = $('.coveo-facet-value-caption')[0];
  facetTitleElement.setAttribute('aria-label', "Custom tooltip");
  facetTitleElement.setAttribute('title', "Custom tooltip");

code is not working for showing custom tooltip,but when i try to use `setTimeout()`function that time code is working to show custom tooltip.i want show custom tooltip without using `setTimeout()`function.

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Dec 4, 2018 11:02 AM

In your code sample, you are altering the caption of individual facet items (rows). Those facet items are reset at every new query when the search results and new facet items are received from the index.

In your code sample, you are attaching to the `afterInitialization` event to run your code. This event is run only once when the page loads. It is also run before the first query is executed. See

To alter facet items tooltip after every query (after every facet items DOM update), you should instead attach to the `deferredQuerySuccess` event. See

However, altering facet items tooltip like this is a questionable practice. Facet items are not always returned in the same order.

Can I ask what are you replacing the out of the box tooltips with?

Gravatar for

Comment by PPatil3, Dec 4, 2018 11:38 AM


Thank you very much for your great reply,Actually i want get all facet title list and replace with my custom title.your suggestion deferredQuerySuccess event is working in my code.Thanks ones again.

Ask a question