tags:

views:

70

answers:

2

Hi Guys,

Here's the story. I've got an unordered list inside a div on my page.

The code:

<div id="move-me">
   <ul>
      <li><a href="#">Link</a></li>
      <li><a href="#">Link</a></li>
   </ul>
</div>

The above code is positioned on the left of the page, now what I want to do is, destroy the div and ul elements and be only left with the links. Then finally append these links to a sidebar list.

Any ideas?

+5  A: 

Easy!

$("#move-me").remove().find('a').appendTo("#somewhere-else");

An example.

altCognito
merci altCognito!
Keith Donegan
+1  A: 

You want to remove the links from the LI tags then add to the sidebar then remove the unordered list. Something like this should work:

$('#move-me > a').appendTo('#sidebar'); $('#move-me').remove();

Absolut40