jQuery .text()

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

<script>
$(function(){
    var text = $('.target-copy').text(); // copy text
    $('.target-paste').text( text ); // paste text
});</script>
<div class="well">
    <strong>copied text:</strong> <span class="label label-info target-copy">The quick <em>brown fox</em> jumps over the <span style="color:yellow;">lazy dog</span>.</span>
</div>
 
<div class="well">
    <strong>pasted text:</strong> <span class="label label-success target-paste"></span>
</div>

Leave a Reply

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