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 8566067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:34:17+00:00 2026-06-11T17:34:17+00:00

tooltip dont work with while loop all the icons show me the info of

  • 0

tooltip dont work with while loop
all the icons show me the info of first icon only
here is the php

$check = odbc_exec($conn,"select * from Item");
while($r = odbc_fetch_array($check)){
$info = $r['Info'];
$Image = $r['image'];
echo  "<span class='hint'><img src='$Image'></span>
<div class='readitem' style='display:none'>$info</div>";

}

jquery : tooltip

<script type="text/javascript">
$(document).ready(function() {
    var changeTooltipPosition = function(event) {
      var tooltipX = event.pageX - 10;
      var tooltipY = event.pageY + 10;
      $('div.tooltip').css({top: tooltipY, left: tooltipX});};
    var showTooltip = function(event) {
    var item = $('.readitem').html();

      $('<div class="tooltip"><center>'+ item + '</center></div>').appendTo('body');
      changeTooltipPosition(event);
    };
    var hideTooltip = function() {
       $('div.tooltip').remove();
    };
    $(".hint").bind({
       mousemove : changeTooltipPosition,
       mouseenter : showTooltip,
       mouseleave: hideTooltip
    });
});

</script>

any solution ?

Thank You ..

  • 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-11T17:34:19+00:00Added an answer on June 11, 2026 at 5:34 pm

    It’s a problem with the var item = $('.readitem').html(); line.

    When you do $('.readitem'), it will match all elements on the page which have that class. When then calling .html() on that, it’ll return the html of the first matched element (thus always showing you the first one).

    What you’d instead need to do, is look within the .hint on which you’re hovering, in order to find the sibling .readitem, and then use the html of that one.

    So, this should work instead:

    var item = $(this).siblings('.readitem').html();
    

    $(this) should be the instance of the .hint on which you are hovering, so you’re trying to find the .readitem in the sibling elements of it.

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

Sidebar

Related Questions

I want to show tooltip in cgridview value as on hover on column it
Possible Duplicate: Programatically show tooltip in winforms application When set a TooltipText on a
Im getting menuItem icon appearing only on last menuItem. If i snoop the app
I am using cluetip to show a tooltip when a user hovers over a
I am not getting a tooltip to work and I think the problem is
someone knows what's going on here? jsbin showing two tooltips where only one should
I am using the qTip jQuery plugin, and want the tooltip to appear only
There's many answers to this problem, but I'm not sure that they all work
I've found that tooltip text in jsyntaxpane's find/replace operation. However, I don't understand what
I need disable tooltip in google geo chart. I tried tooltip.trigger: 'none' and other

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.