stuart-d2
11/11/2014 - 9:22 PM

jQuery : Injecting Content

jQuery : Injecting Content

var str = $("#source").text();
$("#destination").html(str);
 
<title>text demo</title>
  
<body>
 
    <p>The Source div's html content : </p>
    <div id="source"><p>...From one element to another...</p></div>
    <br />
    <br />
    <br />
    <br />

    <p>The Destination div : </p>
    <div id="destination"><p></p></div>
    <p></p>
 
</body>
  p {
    color: blue;
    margin: 8px;
  }
  b {
    color: red;
  }