Moving same-day events into one container

https://www.gree nwic haca demy.org/pag e.cfm?p=85 6&lastid=856&do=logoffadmin

Pw is 2016workorder

I’m trying to move all same-day events into the same container. If you view the console, you’ll see the values seemingly correct, but whenever I go to do the appending, its just appending into the same container it was always in. So indexOfDates is always the correct value, it looks like, but $(this).eq(indexOfDates) is just r eturning the element that you’re looped on.

Even just console logging $(this).eq(1) (a static number) changes during each loop.

$(".calStyle2 > ul > li").each(function() {
            $(this).find(".eventspacer").remove();
            $(this).find("ul:not(.eventobj").remove();
            var indexOfDates;
            $(this).find(">.eventobj").each(function(i) {
                if($(this).find(".event_stackdate:not(.event_stackrepeat)").length) {
                    indexOfDates=i;
                    console.log(indexOfDates + " ran");
                }
                else {
                    console.log(indexOfDates + ": i /// "+ $(this).eq(1));
                    $(this).find(">li").appendTo($(this).eq(indexOfDates));
                    //$(this).remove();
                }
            });
        });

Got it. I had to .parent() and then traverse back down. I as caught up in the .each().

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.