0
votes

My JS code was doing great until i added the following function :

   $(".meassure-combo").change(function() {
 switch ($(this).attr("name")) {
   case "bust-combo":
   case "shou-combo":
   case "wais-combo":
   case "hips-combo":
   case "imse-combo":
   $("[rel='"+$(this).attr("name")+"']").val( $(this).val() ).change();
   break;
 }
 switch ($(this).attr("rel")) {
   case "bust-combo":
   case "shou-combo":
   case "wais-combo":
   case "hips-combo":
   case "imse-combo":
    var type = $(this).attr("rel");
    var val = $(this).val();
   $("[name='"+type+"']").val(val).change();
    CL3D.interpolation(type,val);
   break;
 }
   });

after adding this code i started getting the following error in console

Uncaught RangeError: Maximum call stack size exceeded at RegExp.test ()

what is the problem and how can i solve it ?

thank you in advance

1
We don't know what the problem is when you don't explain what is expected and what is or isn't working and what errors exist. Please review How to Ask - charlietfl
@charlietfl sorry for that i forgot to add the error. the error is : Uncaught RangeError: Maximum call stack size exceeded - majdsalloum
You have an event handler that is triggered from within itself, it's an infinite loop of sorts. - adeneo

1 Answers

2
votes

.change() is called within change event handler. If $("[rel='"+$(this).attr("name")+"']") or $("[name='"+type+"']") also have .className "meassure-combo" then result would be Uncaught RangeError.