javascript - Copy <li> and insert them after themselves -
i want copy contents of each of <ul>'s of selected class, that
<ul class="testowyul"> <li>a</li> <li>b</li> <li>c</li> </ul> will change
<ul class="testowyul"> <li>a</li> <li>b</li> <li>c</li> <li>a</li> <li>b</li> <li>c</li> </ul> it seemed simple, reason cannot make work. problem is, i'm using class (as there going multiple lists of type), , not know how select <ul> , perform clone() , append(). tried chaining $(".testowyul").children().clone().after(".testowyul"); didn't work.
use $.append() function argument:
$(".testowyul").append(function(){return $(this).children().clone();});
Comments
Post a Comment