Please Log-in or Register to get full access to the forums.


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Changing ToolTip Text
10th February, 19:10 (This post was last modified: 10th February 19:12 by DaveRich.)
Post: #1
[Solved] Changing ToolTip Text
I've been reading the documentation and tutorials but haven't been able to find what I need.

I am using qTip 1 (haven't switched over to 2 yet, not sure if what I want to do is possible in qTip 1).

Currently I am using SVG on a page, and when I hover over one of the polygon's (provinces on a country map) it displays a tooltip. This is working properly.

However, I would like to change the tooltip to show a dynamic variable like "average income" for each province over time. Currently I have tried changing the .title attribute and then recalling tooltip.init() but this does not work.

For example, on page load the tooltip could say "average income for some province $12345.67" however, once the user adjusts a date (via a jquery calendar), then it may need to show a different average income.

For example:
JS Code
document.getElementById(provName).title = "Average Income for " + provName + " $" + provIncome + ".";
tooltip.init();


Is there an easy solution to this?
Find all posts by this user
Quote this message in a reply
11th February, 18:46
Post: #2
RE: Changing ToolTip Text
If you know the element you want to udpate the tooltip of, use the updateContent function of the API:
JS Code
$(elementWithTooltip).qtip('api').updateContent('my new content here');
Visit this user's website Find all posts by this user
Quote this message in a reply
13th February, 15:51
Post: #3
RE: Changing ToolTip Text
(11th February 18:46)Craig Wrote:  If you know the element you want to udpate the tooltip of, use the updateContent function of the API:
JS Code
$(elementWithTooltip).qtip('api').updateContent('my new content here');

Thank you for your suggestion. I tried this out and I end up getting:

JS Code
$(provName).qtip is not a function
$(provName).qtip('api').updateCo...provName + ': ' + provRate + '%');


For this example provName, is the name of a province (eg= "Manitoba") and the ID of my element has the id = "Manitoba" as well.
Find all posts by this user
Quote this message in a reply
13th February, 17:02
Post: #4
RE: [Solved] Changing ToolTip Text
Make sure you're calling that function _after_ qTip is loaded, otherwise it will fail as $.fn.qtip won't be defined yet Wink
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Changing the position of the title attribute ianincrete 2 893 6th January 16:54
Last Post: ianincrete
  Adding a simple function to "content:" to select desired text lzw8bk 0 1,463 31st May 19:26
Last Post: lzw8bk
  [Solved] Hover text and AJAX content gottihh 2 2,268 10th May 07:24
Last Post: gottihh
  [Solved] qTip Ajax data for text in a div akhil_csit 1 1,852 14th March 19:27
Last Post: Craig
  Changing HTML Content on Click & Remove/Reinit qTips ifthatdoesntdoit 5 3,249 17th November 09:46
Last Post: ifthatdoesntdoit
  [Solved] qTip Script help - need to remove text MConley 3 1,580 14th November 20:57
Last Post: Craig
  Create tooltip for selected text claudia.guerrero 2 1,610 10th November 03:55
Last Post: rolina
  [Solved] Changing behavior on the fly homerlex 1 1,554 21st August 18:14
Last Post: Craig
  [Solved] Can't dynamically update content text! hoodedperson70 9 5,241 20th July 18:47
Last Post: hoodedperson70
  [Solved] Does qTip work with hilighted text ? i.am.not.korr 4 2,247 8th April 20:00
Last Post: kiddailey



User(s) browsing this thread: 1 Guest(s)