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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:52:46+00:00 2026-06-04T11:52:46+00:00

First off i am not all that familiar with the OOP side of Javascript

  • 0

First off i am not all that familiar with the OOP side of Javascript so i might need to go back to the drawing board and re-write the javascript as what i am trying to do may not be possible, so please let me know if that is so.
I have been searching for a solution for this for a little while now but can’t quite find the same issue in a way that i can understand what i should be changing.

I am using the class defined in this post: https://stackoverflow.com/a/7798773/1027442.

When a combo box is changed (onChange) on the site it calls a Function which calls the function below to show a feedback box on the page:

var display_ajax_feedback = function (){

document.getElementById('ajax_feedback').style.display = 'block';

/*if(document.getElementById('ajax_feedback_active').value == "active"){*/
if(timer){
    timer.add(5000);
    }
else{
    var timer = new Timer(function() { // init timer with 5 seconds
            document.getElementById('ajax_feedback').style.display = 'none';
        }, 5000);

    /*document.getElementById('ajax_feedback_active').value ="active";*/
    }

}

The idea is that the “ajax_feedback” element displays for 5 sec then disappears, unless it is called again in which case 5 seconds is added.

When using this code the if(timer) line always returns false so the timer does not add on time but calls the object again.

I introduced the extra ajax_feedback_active element to force the timer.add method to be called but I get this error:
” Uncaught TypeError: Cannot call method ‘add’ of undefined”

Is there anything that i am obviously doing wrong with this? And/or quick fix or am i going to have to re-think my approach to this?

If you need any further information please let me know.

Thanks in advance,
Richard

  • 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-04T11:52:48+00:00Added an answer on June 4, 2026 at 11:52 am

    Your timer is a variable in the function scope. Take the timer out from that function if you want to create a global reference to it, or get rid of that var keyword.

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

Sidebar

Related Questions

First off, I'm not all that familiar with cookies but I know how they
First off, let me say that I am familiar with content_for . It's not
First off I want to say that I am not using threads or multiple
First off, I am not an AS 400 guy - at all. So please
First off: I know that AES is a block cipher and not a hashing
First off I'm not sure that's the proper title for this question but hopefully
First off I want to be clear that I am not referring to simulcasting
first i must admit that i'm not very familiar with sql server's recursive CTE's
First off I would like to say, that I am not trying to hack
First off, I am not a DBA, but I do work in an environment

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.