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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:28:44+00:00 2026-05-21T04:28:44+00:00

I need to add a mini tooltip to my page and, for odd reasons,

  • 0

I need to add a mini tooltip to my page and, for odd reasons, can’t use the tooltip provided by jquery, so i’m just going to make my own – except it isn’t working! Here’s the simple code:

$('#nav-about a').click(function(){
     showTooltip('#tooltip-about')
}).hover(function(){
     showTooltip('#tooltip-about')
});

and

function showTooltip(e){
    if( $(e).css('display') =="none" ) {
      $(e).show();
    } else {
      $(e).hide();
    }
    return false;
}

If I hover, the tooltip is shown. but, if I click, it is then hidden. Basically, when I click it reads the css(‘display’) as hidden rather than block. Ideas why?? The only reason i’m doing this is for the iPad display. Most users should see the tip on rollover, but iPad users cannot. Other solutions welcome!!!

Thanks!

UPDATE: here’s what worked. I had my logic wrong :). I simply needed to branch on the userAgent instead of trying to handle two things at once.

var isiPad = navigator.userAgent.match(/iPad/i) != null;
if (isiPad){
   $('#nav-about a').click(function(){
    showTooltip('#tooltip-about')
   })
}else{
   $('#nav-about a').hover(function(){
    showTooltip('#tooltip-about')
   });
}
  • 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-21T04:28:45+00:00Added an answer on May 21, 2026 at 4:28 am

    You could reduce the body of your showTooltip() function to…

    function showTooltip(e){
        $(e).toggle();
    }
    

    You could also lose the $() wrapping, if you are sure that a jQuery object will always be passed. However, it doesn’t hurt to wrap it again, and it gives you the flexibility of passing a selector or native DOM element.

    Documentation.

    Also, for explictly checking if an element is hidden, you can use…

    element.is(':hidden')
    

    Documentation.

    Keep in mind that elements with visibility: hidden or opacity: 0 are considered visible by this selector.

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

Sidebar

Related Questions

I can't access a element with its href. Like this example, i need add
need to add a 2nd css stylesheet to a page. do i add a
I need to add folowing html code to JSON using PHP. <a class=btn btn-mini
I need add hint like 'with(index(PK_SomethingObjects))' for optimize my query. How can I add
I need add Auto complete on apex Tabular Form. there is a column as
I need add a new user group for mediawiki. The new group has more
Hї! I have wrote test for my application. I need add item to database
Need to add two same name .csproj class libraries in my solution.Have two project
I need to add recurring events with start time and end time. I used
We need to add a javascript element inside an iframe (its inside the same

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.