In my mind, this should work.
I'm trying to get all the paragraphs inside .one
, to be duplicated and after the first few paragraphs.
http://jsfiddle.net/tmyie/B4f5b/
I have this:
<div class="one">
<p>one</p>
<p>two</p>
<p>three</p>
</div>
I want this:
<div class="one">
<p>one</p>
<p>two</p>
<p>three</p>
<p>one</p>
<p>two</p>
<p>three</p>
</div>
And I am using:
$('.one p').appendTo('.one');
Try this:
$('.one p').clone().appendTo('.one');
.clone() does exactly what it sounds like; clones the selected element(s) (and its descendants) to which you can append as needed.
Fiddle: http://jsfiddle.net/B4f5b/2/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.