0

Can you help me with changing the content of Easy Tooltip dynamically via Javascript? I tried almost everything:

document.getElementById('easy_tooltip').innerHTML(tooltipContent);
$("#easy_tooltip").html(tooltipContent);
$("#easy_tooltip").content(tooltipContent);

But it doesn't work. I cannot access the content of that element.

The example can be found here.

Thank you.

2
  • In the example, the change_tooltip function is never called. Have a look at the Chrome Developer Tools console. Commented Nov 28, 2012 at 10:29
  • jsfiddle.net/k7UZ7/9 - repaired version. Commented Nov 28, 2012 at 10:52

1 Answer 1

1

The way this plugin is built is to use the title attribute of your element, so you can rather update your HTML code like this :

<a href="#" id="tooltip-1" class="tooltip" title="Tooltip 1">Tooltip 1</a>
<br />
<a href="#" id="tooltip-2" class="tooltip" title="Tooltip 2">Tooltip 2</a>

(See this fiddle)

And if you need a dynamic content, you can always modify this attribute with jQuery :

$("#tooltip-1").attr("title", "mycontent");
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, so i need to put ID on all links.
Only if you need to change dynamically the tooltip content! In all cases, you don't need it. And you can also use selectors like $("a:eq(0)") if needed...
Thank you, you are a pure guru!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.