Skip to content

Instantly share code, notes, and snippets.

@csdear
Created November 11, 2014 21:22
Show Gist options
  • Save csdear/c40a93bbcf489b5fabac to your computer and use it in GitHub Desktop.
Save csdear/c40a93bbcf489b5fabac to your computer and use it in GitHub Desktop.
jQuery : Injecting Content
p {
color: blue;
margin: 8px;
}
b {
color: red;
}
<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>
var str = $("#source").text();
$("#destination").html(str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment