jQuery .html()

jQuery .html() gets or sets html content of the target element;
Also check jQuery .text()

js:

$(function(){
    var html = $('.target-copy').html(); // copy html
    $('.target-paste').html( html ); // paste html
});​

html:

<p>
    <strong>copied html:</strong> <span class="target-copy">The quick <em>brown fox</em> jumps over the <span style="color:green;">lazy dog</span>.</span>
</p>

<p>
    <strong>pasted html:</strong> <span class="target-paste"></span>
</p>

Leave a Reply

Your email address will not be published. Required fields are marked *