$("ul").each(function() {
  var ulla = jQuery(this).html();
  //ulla is a 'private' variable here, it's only available inside this
function. that's why it's undefined.
});

This should work:

jQuery(function($){
  var items = $('#la ul').remove().find('li');
  $("#la dl").empty().append( items );
});

By the way, I'm pretty sure having an unordered list directly inside a
<dl> is invalid mark-up.

- ricardo

On Feb 17, 1:30 am, Mathew <msin...@gmail.com> wrote:
> 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

Reply via email to