0

I have a paragrah that I need to replicate dynamically. How do I do this in jQuery? Here is example code:

<p class="info">Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>

The paragraph needs to be copied to another part of the page that will look like this:

<p id=print-info> jQuery inserted paragraph text </p> 

I have thought of using the .attr() method but not sure how to go about doing that for paragraph text.

1 Answer 1

3

Use this line, as seen in this fiddle

$('#print-info').html($('.info:first').html());​
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.