Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:04:28+00:00 2026-06-02T03:04:28+00:00

I am using JQuery to show a tooltip-Box after clicking an image. So far,

  • 0

I am using JQuery to show a tooltip-Box after clicking an image. So far, I can select the correct div(s) and then I can identify the correct sub-div which contains the text-node as well. Unfortunately I am not able to get the text node of the sub-div. What is wrong – I am getting ‘null’ after calling html() on currentDescriptionContainer? Thanks in advance!

var tooltipItems = jQuery('.tooltipContainer').length;
var i=0;
for (i=0; i<tooltipItems; i++){
    jQuery('.tooltipContainer').eq(i).bind('click', function(){
    var currentContainer = jQuery('.tooltipContainer').eq(i);
    var currentDescriptionContainer = currentContainer.find('div');
    var currentDescriptionText = currentDescriptionContainer.html();
    console.log(currentDescriptionText);
    showRendererToolTipForIpad(this, currentDescriptionText);
    hideRenderedToolTipAfterTimeout();
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:04:31+00:00Added an answer on June 2, 2026 at 3:04 am

    your code could be really simplified. try this code, open the console and see if the execution is correct

    var tooltipItems = $('.tooltipContainer');
    tooltipItems.bind('click', function() {
         var divs = $(this).find('div'), cdText;
    
         console.log('Element has %d descendent div/s' , divs.length);
    
         if (divs.length) {
             cdText = divs.text();
             console.log('Text found: ' , cdText);
             showRendererToolTipForIpad(this, cdText); /* this is the i-th DOM node */
             hideRenderedToolTipAfterTimeout();
         } 
    });
    

    Note that html() when applied to a collection of elements affects only the first element, so in this example I used text() instead (and I don’t know how many elements you’re expecting to retrieve)

    About your code, I suspect you’re creating an involuntary closure that could be a cause of your problem : when the click event occurs you have

    var currentContainer = jQuery('.tooltipContainer').eq(i);
    

    but since the for cycle has already reached the end, the variable i will be the last index of your collection. So no matter what tooltip you click, currentContainer will always be a reference using that index

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a jquery to show fields of HTML like select,text, image. But
I am using jQuery to show/hide a div container (#pluginOptionsContainer), and load a page
Im using JQuery with css to show div's on a page with the Click
Using jQuery, can you show me the syntax for playing a sound? I would
I'm using jQuery to show a success message after a form is submitted. The
I am using jQuery to show and hide a div by adding/removing a class
I've been looking at some jQuery plugins to show a tooltip around an image
I have created a nice tooltip box using JQuery and I used some plugin
I am inserting content to a div using jquery like: $('#divItem').append(<a href='abcd.aspx' class=toolTip target='_blank'>Go
I'm using jquery to show animated MSN like window at the bottom of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.