To get or set the element text content (including the child elements), text()
method can be used.
<script>
$("#div3").html($("#div2").text());
</script>
Above code snippet will set the text content of element “div2” as the html content to the element “div3”.
<script>
$("#div3").text("This text is set by <b>jQuery</b> !");
</script>
Above code snippet will set specified text to the element whose id is “div3”.
Views: 4675 | Post Order: 34