Find ID of element in tippy.js instance

21 views Asked by At

I am using tippy.js, when I look at the instance list, I see the list of all elements.

What I want to do is to change the content of an element dynamically. I can do this with setContent. However, in order to do this, I need to write the ID of tippy.js. For example, if I want to change the html content of any element, I write the following instance[13].SetContent("new content"); if I write it, it changes.

In short, how can I write the id of the HTML element in instance and get the ID of tippy.js?

Bad

instance = tippy('[data-tippy-content],[data-tippy-placement]', {
    allowHTML: true,
    size: 'large',
    trigger: 'mouseenter',
    // animation: 'scale-subtle',
    // animateFill: false,
    duration: 200,
    distance: 50, 
    placement: 'right',
    arrow: true,
    inertia: true,
    interactive: false,
    popperOptions: {
        modifiers: {
            preventOverflow: { enabled: false },
            hide: { enabled: false }
        }
    },
    beforeShown: function () {
         
    },
    shown: function () {
       
    },
    beforeHidden: function () {
        
    },
    hidden: function () {
        
    },
    wait: function (show, event) {
      
    }
});

I tried instance.find("structure_2") or instance.includes("structure_2") but no luck. I want to change the tooltip content dynamically.

0

There are 0 answers