Copying children of a <ul> to another <ul> using jQuery
How can I copy copy content of a ul
that is li
's inside it to开发者_开发百科 another ul
.
Say we have t = $("ul#target")
and s = $("ul#source")
.
You can .clone()
the children then use .appendTo()
to put them on the destination <ul>
, like this:
$("#source").children().clone().appendTo("#target");
s.children().clone().appendTo(t)
精彩评论