Need help assigning cookie calues to current div id's in col

Need help assigning cookie calues to current div id's in col

I have a sortable div interface with #id's used. I have a serialized value in a cookie that I have in an array that I need to loop through and assign those current ids in the order from the cookie. Obviously I am trying to save page state (div order);

function getPage(){
            //var newOrder[];
            
            
            var sortOrder = $.cookie('pageState');
            var delim = "&"; // delimiter for pages in cookie
            
            // get the previous cookie (if any), split it into an array
            var visited = ($.cookie('pageState') || "").split(delim);
            
            // holders for Div Order from Cookie ************************************************************
            var col1NewOrder = visited[0];
            var col2NewOrder = visited[1];
            var col3NewOrder = visited[2];
            var col4NewOrder = visited[3];
            
            // holders for Current Div Order Page ***********************************************************
            var currCol1 = $('.col1').children('div').attr('id');
            var currCol2 = $('.col2').children('div').attr('id');
            var currCol3 = $('.col3').children('div').attr('id');
            
            var colItems3 = $('.col3 .sortItem').each(function(){
               var name = $(this).attr('id');
               console.log(name);
               
            });
            
               if(colItems3.length > 0){
                  $(this).each(function(){
                     $(this).attr('id') == col3NewOrder;
                  })
               }
                  
            //var newOrder[0] = $('#colOne').children('div').attr('id');
            // set the new cookie
            $.cookie('pageState', visited.join(delim));
            return visited;
            
      };


Any help is greatly appreciated.