im trying to look into a div and find each instance of a ul in that div and get all the li elements into a variable then remove the ul's and append the new ul with li from variable. here is what i have so far: Code: //var ulla = ' '; jQuery("ul").each(function() { var ulla = jQuery(this).html(); }); jQuery("#la dl").remove(); jQuery("#la").append("<dl><ul>" + ulla + "</ul></dl>");
the structure is like: <dl> <ul> li li li li </ul> <ul> li li </ul> </dl> im trying to get all of the li elements from all ul elements and store them so I can remove all the multiple ul elements and make one ul and put all the li elements inside this new single ul. I keep trying variations of this with different selectors and forms of each and i cant get anything into that ulla variable, i get undefined when loading the page for ulla with code above. can anybody see what i am doing wrong