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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:45:53+00:00 2026-06-15T14:45:53+00:00

I am getting the error message too much recursion. Why? The following code is

  • 0

I am getting the error message too much recursion. Why?

The following code is supposed to expand/collapse the table rows upon clicking on the image. If the image does not exist the there would be a div upon clicking on which the last rows will expand/collapse

$(document).ready(function() {
    $(".ui-dialog-titlebar").hide(); 
    //$(".lvlcollapse .level4").hide();
    $("tr.lvlcollapse").click(function() {
        //alert($(this).find("img").attr("src"));
        if ($(this).find("img").attr("src") != undefined) {
            var tnow = $.now();
            var allClass = $(this).attr('class');
            var level = getLevel($(this));
            var state = getClass($(this), '^clicked\\d+$');
            if (state == undefined) {
                state = "closing";
                $(this).addClass("clicked" + tnow);
            }
            else {
                $(this).removeClass(state);
                tnow = state.substr(6);
            }
            switchImage($(this));
            $(this).nextAll(".lvlcollapse").each(function() {
                var sublvl = getLevel($(this));
                var subtnow = 0;
                var substate = getClass($(this), '^closed\\d+$');
                if (substate != undefined) subtnow = substate.substr(5);
                if (sublvl > level) {
                    if (state == "closing" && subtnow == 0) {
                        $(this).addClass("closed" + tnow);
                        $(this).toggle();
                    }
                    else if (subtnow == tnow) {
                        $(this).removeClass(substate);
                        $(this).toggle();
                    }
                }
                else {
                    return false;
                }
            });

        } else {
            //alert('No Image ');
            $(".button").click(function(event) {
                //var $this2 = $(this);
                var allLevel4 = $(this).next(".lvlcollapse.level4");
                $($(this)).toggle('fast', function() {
                    if (allLevel4.is(":visible")) {
                        $(this).html("Show Attempts");
                        alert('hello2');
                        return false;
                    } else {
                        $(this).html("Hide Attempts");
                        alert('hello3');
                        return false;
                    }

                }) event.preventDefault();
            }).trigger("click");
        }
    });
    $(".lvlcollapse.level2").filter(function() {
        return $(this).next(".lvlcollapse.level3").is(":visible");
    }).trigger("click");
    //$(".button").filter(function() { return $(this).next(".lvlcollapse.level4").is(":visible"); }).hide();
});​
  • 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-15T14:45:54+00:00Added an answer on June 15, 2026 at 2:45 pm

    One thing that looks funny is that you’re adding a click handler to the button within the click handler for tr.lvlcollapse. That will create a new handler everytime you click on it and it will trigger all the previous handlers when you call trigger.click()

    Since the click event bubbles, it will also trigger the click handler for all the parents. If the button is inside tr.lvlcollapse, that could be your problem.

    Two things you need to do:

    • Don’t set handlers from within handlers unless you really know what you are doing and you have a plan to unbind the handlers, or at the very least, remove existing binding before binding. Note that this is less common, you typically do not add handlers from within handlers.

    • Call event.stopPropagation() if you don’t want ancestor nodes to handle the click

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

Sidebar

Related Questions

I'm getting the error message when running the following code from a C# console
Am getting following error message on calling WCF service: The formatter threw an exception
I'm getting this error message with the code below: class Money { public: Money(float
I am getting following error message when using Doctrine ORM in Codeigniter. ( !
I am using rails 2.3.8 with sphinx search, am getting the following error message
We recently started getting the following error message in TFS 2010 automatedd builds: C:\Builds\1\MyProject\MyProject
When I run the following code, I keep getting a glibc detected error when
I'm getting error messages for no reason in RAD 8: And the error message
Am getting this error message and matched my brackets and couldn't find anything wrong.
I'm getting this error message whiile running a Webservice I'm working on. it builds,

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.