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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:06:44+00:00 2026-05-16T06:06:44+00:00

I have the following code example (see below). My problem is that the tooltip

  • 0

I have the following code example (see below). My problem is that the tooltip doesn’t show the “old” text after I go away with the cursor – any ideas?

<style type="text/css">
#tooltip {
    position: absolute;
    background: #FFF;
    display: none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('body').append('<div id="tooltip"></div>');
    var tt = $('#tooltip');
    $('a.tooltip').each(function(){
        $(this).data('title', this.title).attr('title', '');
    }).hover(function(){
        var t = $(this), o = t.offset();
        tt.html(t.data('title')).css({top: o.top, left: o.left}).fadeIn('fast');        
    },
    function(){
        tt.css({display: 'none'});
    });
});
</script>
</head>
<body>

    <a href="#" class="tooltip" title="VeryLongTextMoreTextVeryLongText">VeryLongText...VeryLongText</a> 
  • 1 1 Answer
  • 4 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-16T06:06:45+00:00Added an answer on May 16, 2026 at 6:06 am

    The problem is the mouse enter the <a> but then it’s on the tooltip element, so you need to split the hover, like this:

    $('body').append('<div id="tooltip"></div>');
    var tt = $('#tooltip');
    $('a.tooltip').each(function(){
        $(this).data('title', this.title).attr('title', '');
    }).mouseenter(function(){
        var t = $(this), o = t.offset();
        tt.html(t.data('title')).css({top: o.top, left: o.left}).fadeIn('fast');
    });
    tt.mouseleave(function() {
      $(this).stop().hide();
    });
    

    You can give it a try here, since the mouse over occurs on the <a>, add the .mouseeenter() to it. But, since you’re then over the #tooltip on top of the <a>, to hide it you need the .mouseleave() on the #tooltip itself.

    What’s happening currently is it starts to .fadeIn(), but as soon as it does so the mouseleave event happens (since #tooltip isn’t a child), so the display: none; is triggered (you can use .hide() here). The display:none; does happen, but the next interval of the fade just reverses it, so you end up with a faded-in element. To prevent that in the mouseleave handler above, we’ve added .stop() to stop further fading for this hover.

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

Sidebar

Related Questions

I have the following example code: $dataProvider = new CActiveDataProvider('firstTable', array('criteria' => array( 'select'
Say I have the following code: <div onclick='location.href=http://www.example.com/'> <a href='#' onclick='alert(blah)'>click</a> </div> Is there
On a report I have the following code for a field: =Sum([PartQty]*[ModuleQty]) Example results
Say suppose I have the following Java code. public class Example { public static
I have the following code that takes a String of milliseconds (will be from
I have the following jquery code: $(document).ready(function() { $(body[class*=page-calendar-practices] #content-header h1#title).after(<div id='athletics_practice-schedule'><div id='inner-title'><a href='www.example.com'
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have following code for loading image from url in xml parsing endElement method

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.