question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to use the same HTML template for multiple tooltips

See original GitHub issue

Hello,

I have an issue, where I’m unable to use the same HTML template for multiple tooltips.

Here’s my init code:

var poppers = Array.from(document.querySelectorAll('[data-toggle="popper"]'));
tippy(poppers, {
	position: 'bottom',
	trigger: 'click',
	duration: 100,
	interactive: true,
	arrow: true,
	performance: true,
	html: document.querySelector('.popper')
});

Only the last [data-toggle="popper"] is able to toggle the tooltip, the first ones just display an empty box.

Any ideas how to fix this? 😃 Popper.js and tippy.js are looking very awesome!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
atomikscommented, Sep 15, 2017

Alright, I’ve simplified the hell out of the Creating HTML Templates section. That was really wordy and hard to read before. Now I’ve simplified it and explicitly noted the two options.

https://atomiks.github.io/tippyjs/#creating-html-templates

2reactions
padicommented, Sep 14, 2017

I kind of stumbled upon this and debugged this the hard way just a few weeks ago (new to using tippy.js by maybe about a month now). I was going to suggest a fix for it but there’s a workaround: use Node.cloneNode(true).

It’s not written in the docs, but the template you’re referring to (‘.popper’) is being taken away from the DOM. Check it out in your project.

@atomiks the long term fix is to either handle the cloning of the node internally or update the docs to describe this behavior.

Hope this helps @raineluntta.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple tippy.js tooltips with html content - Stack Overflow
js. This content varies - it might me just image or text formatted with HTML tags or text + image(s). How can I...
Read more >
Tooltips with rich HTML content – amCharts 4 Documentation
Let's start with a pretty basic chart with multiple line series, a cursor, and a tooltipText set for the last series, that consolidates...
Read more >
Bootstrap Tooltips - examples & tutorial
Bootstrap Tooltip displays informative text when users hover, focus, or tap an element. They display text tips next to the element in question....
Read more >
How to Create an HTML Tooltip [+ Code Templates]
There are several ways to create a tooltip with pure HTML and CSS. In this section, we'll explain a few methods, as well...
Read more >
Tooltips - Bootstrap
Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-attributes for local title ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found