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

  • Home
  • SEARCH
  • 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 8713169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:16:41+00:00 2026-06-13T05:16:41+00:00

Ok so I have a function in my AJAX application which sticks a tooltip

  • 0

Ok so I have a function in my AJAX application which sticks a tooltip in the corner after a certain amount of time to help prompt the user along with what they’re doing. There is also a second function which clears the timeout if the user clicks somewhere else as that tooltip wont be relevant anymore.

I’m starting to have an issue now with setting multiple tooltips on timeouts, setting them is fine but I can’t find an efficient way to cancel them if the user moves on.

Currently my code looks like this

var tuttimer = new Array();

function showtooltip(uniqueid, delay){
    tuttimer[uniqueid] = setTimeout(function(){
        //Create tooltip code here
    },delay);
}

function clearTuttimer(){
    if(typeof tuttimer != 'undefined'){
        for (var i = 0; i < tuttimer.length; i++) {
            clearTimeout(tuttimer[i]);
        }
    }
}

So the tuttimer array is created at page load and then whenever a user does something which would case a tooltip to display the showtooltip() function is called and is given a unique id and a delay time.

But if the user were to move on to something else it calls the function clearTuttimer() which checks to see if the array exists and then loops through and clears each individual timeout.

However this isn’t working. Hopefully someone can point me in the right direction. Many 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-06-13T05:16:42+00:00Added an answer on June 13, 2026 at 5:16 am

    If you use array, then use Array.push method.

    var tuttimer = [];
    
    function showtooltip(delay){
        tuttimer.push(setTimeout(function(){
            //Create tooltip code here
        },delay));
    }
    
    function clearTuttimer(){
        for (var i = 0; i < tuttimer.length; i++) {
            clearTimeout(tuttimer[i]);
        }
    }
    

    If you want to use uniqueid, then use an object instead of array.

    var tuttimer = {};
    
    function showtooltip(uniqueid, delay){
        tuttimer[uniqueid] = setTimeout(function(){
            //Create tooltip code here
        },delay);
    }
    
    function clearTuttimer(){
        for (var k in tuttimer) {
            clearTimeout(tuttimer[k]);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple jQuery.ajax function which loads a user control from the
i have an ajax script which is used to set the user location, the
I have a asp.net MVC3 web application in which i search for a certain
I am writing an Ajax application which uses a callback function to add a
I currently have a jQuery ajax function which posts a multi-dimensional array to my
I have a form in my application which I need to submit via Ajax
I am creating an asp.net c# web application.In which i have a ajax modal
I have an application in which most requests are submitted via AJAX, though some
I have developed an ajax application in which the server page is called every
I have a basic ajax application, which will not work, instead the php code

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.