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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:52:10+00:00 2026-06-17T05:52:10+00:00

I am trying to show Jquery UI tooltip on page load with a close/cross

  • 0

I am trying to show Jquery UI tooltip on page load with a close/cross mark icon inside tool tip content. Tooltip should be closed on clicking X icon. I dont want to use any plugins. Please suggest logic.

Tried the below code to hide tooltip after 5 seconds.

var dur=5000; 
$(document).tooltip({
  show:{
      effect:'slideDown'
  },
  track:true,
  open: function( event, ui ) {
      setTimeout(function(){
      $(ui.tooltip).hide();
   }, dur);
  }
});

Tried below code to Show tooltip

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8" />
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
      $(function () {
          $(document).tooltip({
              position: {
                  using: function (position, feedback) {
                      $(this).css(position);
                      $("<div>")
                        .addClass("arrow")
                        .addClass(feedback.vertical)
                        .addClass(feedback.horizontal)
                        .appendTo(this);
                  }
              }
          });
      });
  </script>
  <style>
  .ui-tooltip, .arrow:after {
    background: black;
  }
  .ui-tooltip {
    padding: 10px 20px;
    color: white;

    font: 8px "Helvetica Neue", Sans-Serif;
    text-transform: uppercase;
  }
  .arrow {
    width: 70px;
    height: 16px;
    overflow: hidden;
    position: absolute;
    left: 50%;
    margin-left: -35px;
    bottom: -16px;
  }
  .arrow.top {
    top: -16px;
    bottom: auto;
  }
  .arrow.left {
    left: 80%;
  }
  .arrow:after {
    content: "";
    position: absolute;
    left: 20px;
    top: -20px;
    width: 25px;
    height: 25px;
    box-shadow: 6px 5px 9px -9px black;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    tranform: rotate(45deg);
  }
  .arrow.top:after {
    bottom: -20px;
    top: auto;
  }
  </style>
</head>
<body>

<p title="Sample Tool Tip Text">Tooltips</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-17T05:52:11+00:00Added an answer on June 17, 2026 at 5:52 am

    If you want to use the tooltip in this manner, you cannot use $(document).tooltip(). Instead, you would have to use $(selector).tooltip().focus(), which will force the tooltip open.

    Then you would need to bind a click event and do the following: $(selector).tooltip("destroy").

    Using your jsfiddle, I’ve done the following changes:

    HTML:

    <p id="p1" title="Sample Tool Tip Text">Tooltips</p> 
    

    JAVASCRIPT:

    $(function () {
         $("#p1").tooltip({
           items: "p", //use this to override content - in this example, I am using "p" but you can also use classes/id's/etc
           content: function (){
            if ($(this).is("p") ) {
              var text = $(this).attr("title");
              return text + '<span style="position:absolute;top:0;right:0;" class="tooltipClose ui-icon ui-icon-circle-close"></span>';
             }
           },
           position: {
             using: function (position, feedback) {
               $(this).css(position);
               $("<div>")
               .addClass("arrow")
               .addClass(feedback.vertical)
               .addClass(feedback.horizontal)
               .appendTo(this);
             }
           }
         }).focus();
    
       $(".tooltipClose").click(function(){
          $("#p1").tooltip("destroy");
       });
     });
    

    Here is a demo: http://jsfiddle.net/u8kX9/9/

    Hope this is what you’re looking for! Let me know if you need anything else!

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

Sidebar

Related Questions

im trying to use jquery tools tooltip ( http://flowplayer.org/tools/tooltip.html#events)on a form to show hints
Trying to show/hide severals divs using jquery after each news on my page. <div
Using the wordpress loop and jquery, I'm trying to show/hide the content of the
I am trying to use jQuery to show a div when the user selects
I'm trying to create a Hide/Show button with jQuery. When .cminus is clicked, it
I am trying to use the HTML5 file API and jQuery to show the
I am trying to find a jQuery solution to show the first 3 items
I'm trying to show a jquery dialog box with code like: var message =
Im trying to show/hide a div using jquery when a link gets clicked. I
I am trying to show the street view in a jquery dialog box with

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.