Skip to content

Instantly share code, notes, and snippets.

@EragonJ
Last active December 27, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EragonJ/7300164 to your computer and use it in GitHub Desktop.
Save EragonJ/7300164 to your computer and use it in GitHub Desktop.
Template 1 with jQuery
$(document).ready(function(){
// you can cache this $tmpl for later use
var $tmpl = $("#tmpl").remove().clone();
$tmpl.find(".header").text("This is header");
$tmpl.find(".content").text("This is Content");
$tmpl.removeClass("hide");
$(".target").append($tmpl);
});
<body>
<div id="tmpl">
<h1 class="header"></h1>
<p class="content"></p>
</div>
<div class="target"></div>
</body>
.hide {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment