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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:59:09+00:00 2026-05-23T06:59:09+00:00

I want to be able to create a tooltip, but having referencing from two

  • 0

I want to be able to create a tooltip, but having referencing from two different places

    this.tooltip = function(){  

        xOffset = 10;
    yOffset = 20;       


    $("div.tooltip").hover(function(e){                                           
        this.t = $("a.tooltip").title;
        $("a.tooltip").title = "";                                    
        $("body").append("<p id='tooltip'>"+ this.t +"</p>");
        $("#tooltip")
            .css("top",(e.pageY - xOffset) + "px")
            .css("left",(e.pageX + yOffset) + "px")
            .fadeIn("fast");        
    },
    function(){
        this.title = this.t;        
        $("#tooltip").remove();
    }); 
    $("div.tooltip").mousemove(function(e){
        $("#tooltip")
            .css("top",(e.pageY - xOffset) + "px")
            .css("left",(e.pageX + yOffset) + "px");
    });         
};



// starting the script on page load
$(document).ready(function(){
    tooltip();
});

This is where I wanted to be able to work with. I have a text “Roll over for tooltip”, then a box saying “Web Standards Magazine” will pop up.

<div class="tooltip">Roll over for tooltip</div>
<span class="tooltip" title="Web Standards Magazine"></a>

I know there’s ways where you can just have it one area like

<span class="tooltip" title="Web Standards Magazine">Roll over for tooltip</a>

The reason why i’m not doing this is because I’m working on a small part of a larger file and I don’t want to mess anything up.

I’m getting undefined variable. Need help please, Thanks!

  • 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-05-23T06:59:10+00:00Added an answer on May 23, 2026 at 6:59 am

    Assuming you’re doing some event like a hover(), you can concatenate the class of the element that received the event into the id-selector[docs] in order to select the corresponding <div>.

    $('img[class^="tooltip"]').hover(function() {
        $('#' + this.className).fadeIn();  // fadeIn, or do whatever with the div
    },
      function() {
        $('#' + this.className).fadeOut();  // fadeOut, or do whatever with the div
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to create an email message with an attachment, but
I want to be able to create modal dialogs, with, for example close: function()
We want to be able to create log files from our Java application which
I want to be able to create a GUID/UUID on the iPhone and iPad.
I want to be able to create links looking like buttons with dynamic text
I want to be able to create a temporary text File in Java to
I want to be able to create the XSD file for my typed dataset
I want to be able to create a KPI List on my MOSS 2007
In Delphi, I want to be able to create an private object that's associated
Basically i want to be able to dynamically create a temp table based off

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.