So, I have a problem with this FOR loop, which I just cannot understand. In this case, I know that this must be repeated at least twice. An array at least looks something like this:
dTrackerArray = {sParentValue, 1234, sParentValue, 5678}
But for some reason, this for loop only removes one instance instead of all of them.
var check = $.inArray(sParentValue, dTrackerArray); if (check != -1) { for(var i = dTrackerArray.length; i > 0; i--) { if( dTrackerArray[i] === sParentValue ) { dTrackerArray.splice(i,1); dTrackerArray.splice(i-1,1); } }}
I really appreciate any help I can get here! Thanks!
EDIT: 2nd splicing - remove 1234 "connected" using sParentValue. It seems to be working fine.
source share