Click here to Skip to main content
14,599,202 members

how to solve Uncaught RangeError: Maximum call stack size exceeded in jquery

n!khil asked:

Open original thread
Hello all, i have a grid cell click method implemented using jquery as follows
function usercellclick() {

            $("#<%=dgv_buslayout.ClientID%> tr:has(td)").click(function (e) {
                var selTD = $(e.target).closest("td");
                var $target = $(e.target);
                if (!$target.is('input:checkbox')) {
                    $($target).find('input:checkbox').each(function () {
                        if (!$(this).prop('disabled')) {
                            if (this.checked) {
                                this.checked = false;
                                getseats();
                            }
                            else {
                                this.checked = true;
                                getseats();
                            }
                        }
                    })
                }
            });
 });
function getseats() {
            seatCheckUncheck(document.getElementById("<%= txtselectedseats.ClientID %>"), document.getElementById("<%=txtseatcount.ClientID %>"));
           
            OnSuccess();
        }
function OnSuccess() {
            var seatsCount = document.getElementById("<%= txtseatcount.ClientID %>").value;
            if (seatsCount == 0) {
                var row = $("[id*=dgv_passengerdetails] tr:last").clone(true);
                $("[id*=dgv_passengerdetails] tr").not($("[id*=dgv_passengerdetails] tr:first-child")).remove();
                $("td", row).eq(0).html('');
                $("[id*=dgv_passengerdetails]").append(row);
            }
            else{
                var row = $("[id*=dgv_passengerdetails] tr:last").clone(true);
                $("[id*=dgv_passengerdetails] tr").not($("[id*=dgv_passengerdetails] tr:first-child")).remove();
                var seats = (document.getElementById("<%= txtselectedseats.ClientID %>").value).split(",");
                for (var count = 0; count < seatsCount; count++) {
                    $("td", row).eq(0).html(seats[count]);
                    $("[id*=dgv_passengerdetails]").append(row);
                    row = $("[id*=dgv_passengerdetails] tr:last").clone(true);
                }
            }
        }

when i click continue 6 7 times it throws an exception as Maximum call stack size exceeded
if i remove the else part of function OnSuccess() then it works fine. help me, thanx in advance
Tags: ASP.NET, jQuery

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100