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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:30:04+00:00 2026-05-13T06:30:04+00:00

While I have the problem itself seemingly resolved, I’m hoping someone can shed some

  • 0

While I have the problem itself seemingly resolved, I’m hoping someone can shed some light on the why of this…

Below are two snapshots of the same function whose job is to remove a div that contains a user feedback message. It’s setup to use an optional timeout, if a timeout is specified it makes a call to itself using setTimeout() which then removes the div.

The only difference between the two versions of the function is where this.remove() is called – in the problem version I send a message to the log using blackbirdjs first and then call this.remove() – after this executes the log is flooded with unending log messages of “Removing feedback div…” as fast as the browser can pump them in.

In the working version, however, I simply reverse the order and everything executes normally and all is well…

I’m boggled, I would think that the order in this case would be trivial but apparently not. Can anyone shed some light on why this would be happening? Is this a jQuery bug or a problem with blackbird or some kind of weird quirk of JavaScript in general?

NOTE:
I had some mixed success using a call to confirm() – if it came back false I told it to return and this stopped it – however, just adding return after the remove call had no effect.

Interestingly enough, either version seems to work fine in IE8 – so this may be a firefox/gecko problem?

Problem Code:

function clear_feedback(target_container, timeout){
    log.debug("timeout: " + timeout);
    log.debug("target_container: " + target_container);

    if(timeout == undefined){
        log.info("removing target...");

        $(target_container).children(".update_feedback").slideUp("slow",
            function() {
                log.info("Removing feedback div...");
                this.remove();
            }
        );
    }
    else{
        log.info("Setting timeout, THEN removing target...");

        setTimeout("clear_feedback('" + target_container + "')", timeout);
    }
}

Working Code:

function clear_feedback(target_container, timeout){
    log.debug("timeout: " + timeout);
    log.debug("target_container: " + target_container);

    if(timeout == undefined){
        log.info("removing target...");

        $(target_container).children(".update_feedback").slideUp("slow",
            function() {
                this.remove();
                log.info("Removing feedback div...");
            }
        );
    }
    else{
        log.info("Setting timeout, THEN removing target...");

        setTimeout("clear_feedback('" + target_container + "')", timeout);
    }
}
  • 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-13T06:30:04+00:00Added an answer on May 13, 2026 at 6:30 am

    You should have checked your browsers error console instead of just relying on the blackbirdjs console.

    Then you would have noticed that the browsers error console is flooded with error messages too (with either of your code versions)

    The actual problem in your code is

    this.remove();
    

    this is a HTML DOM element in the callback-function and doesn’t have the function remove() thus the children only get hidden but not really deleted. And on this.remove() you get an exception. As the callback-function throws an exception jQuery ends up in an endless loop trying to do its job

    What you need to do is wrapping the element in a jQuery object.

    $(this).remove();
    

    Now it’s also clear why the second version seems to have fixed the error

    log.info("Removing feedback div..."); //error logged
    this.remove();  //exception
    
    this.remove();  //exception
    //log line not executed as previous line threw exception
    log.info("Removing feedback div...");
    

    The fact that jQuery even ends up in and endless loop and if this is correct behavior is debatable and needs more investigation deeper in the inner-workings of jQuery. But this isn’t of interest to you

    For those interested there is realted bug ticket

    http://dev.jquery.com/ticket/2846

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

Sidebar

Ask A Question

Stats

  • Questions 267k
  • Answers 267k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You want a modal dialogue, or just a notification message?… May 13, 2026 at 12:56 pm
  • Editorial Team
    Editorial Team added an answer Got the answer: The MGTwitterEngine wants a unsigned long, but… May 13, 2026 at 12:56 pm
  • Editorial Team
    Editorial Team added an answer How about: return ((string) x.Element(elementName)) ?? ""; In other words,… May 13, 2026 at 12:56 pm

Related Questions

Some of the queries I have written inside MS-Access are getting deleted automatically. And
I have a small C program to calculate hashes (for hash tables). The code
*I'm using Java. I have this thread, agent, that explores a room to determine
I'm currently working on a WPF (with C# behind the scenes) system which requires
I've actually solved this, but I'm posting it for posterity. I ran into a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.