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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:05:54+00:00 2026-06-15T01:05:54+00:00

I imagine this is simple and some sort of a scoping problem- yet I

  • 0

I imagine this is simple and some sort of a scoping problem- yet I am stuck. In the code below, I’d like to see an alert with either “foo!” or “bar!’ when I mouse over the div’s. Instead I see empty content. How do I address the current element that matched the selector from the spot where I have the alert()? TIA.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Test Case</title>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />

    <!-- Tooltip classes -->
    <link rel="stylesheet" href="../src/tip-yellow/tip-yellow.css" type="text/css" />

    <!-- jQuery and the Poshy Tip plugin files -->
    <script type="text/javascript" src="includes/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../src/jquery.poshytip.js"></script>

    <script type="text/javascript">
        //<![CDATA[
        $(function(){
            $("span[name='entity']").poshytip({
                className: 'tip-yellow',
                content: function(updateCallback) {
                            var title = $(this).attr('title');
                            alert(title);
                            updateCallback(title);
                          },
                showTimeout: 1,
                alignTo: 'target',
                alignX: 'center',
                offsetY: 5,
                allowTipHover: true
            });
        });
        //              
        //]]>
    </script>   
</head>

<body>
    <p><span name="entity" title="foo!">Hover for a tooltip 1</span></p>
    <p><span name="entity" title="bar!">Hover for a tooltip 2</span></p>

</body>
</html>
  • 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-15T01:05:55+00:00Added an answer on June 15, 2026 at 1:05 am

    Your selection using $(this).attr('title') is correct. However, since poshytip uses the title attribute internally, it appears to be modifying the title attribute temporarily. You can see this behavior by setting a breakpoint there: $(this) references the span, but the title is blank.

    When you select the span outside of the content callback, the title is there — for example, from a debugger using $("span").attr("title")

    Since poshytip’s purpose is to give you enhanced tooltips, this is probably expected. In fact, if you remove your content function entirely, you will see that the correct title / tooltip pops up:

        $(function(){
            $("span[name='entity']").poshytip({
                className: 'tip-yellow',
                showTimeout: 1,
                alignTo: 'target',
                alignX: 'center',
                offsetY: 5,
                allowTipHover: true
            });
        });
    

    Specifying the content method is useful for calculating the title (e.g. if you wanted to return some other value, from content, the tooltip would display it).

    Also, the updateCallback is mainly used to update the tooltip asynchronously:
    http://vadikom.com/demos/poshytip/#async-content

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

Sidebar

Related Questions

Imagine a simple case like this: class Book has_many :chapters end Let's say in
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
I imagine this has a rather simple answer <% for user in @users %>
Imagine this as the code from build.xml: <project name=test project> <target name=first> <echo>first</echo> </target>
This should be a simple matter, but for some reason I can't grasp it.
Imagine the following two entities. Element is simple class containing some data: @Entity public
imagine this html on a page <div id=hpl_content_wrap> <p class=foobar>this is one word and
Imagine this scenario: in our company there is an employee that play around graphic,css,html
Imagine this subroutine: sub test(&&) { my $cr1 = shift; my $cr2 = shift;
Imagine this scenario: You have a desktop and a laptop. The desktop has a

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.