Appending content simply with jQuery

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');

Answers


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/


Need Your Help

URLError: <urlopen error [Errno 104] Connection reset by peer>

python facebook facebook-fql

Whenever I make a call to facebook server to fetch user data using FQL, 10% of the time I get

Should Partial Views contain <head> element

web partial-views visual-studio-2013 asp.net-mvc-5 head

I encounter in some web app that some partial view that is used has head element (it loads some Jquery things).