Skip to content

Instantly share code, notes, and snippets.

@sz332
Created February 21, 2018 14:45
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 sz332/6b2ffa2062ca31105e1248432c3b39d7 to your computer and use it in GitHub Desktop.
Save sz332/6b2ffa2062ca31105e1248432c3b39d7 to your computer and use it in GitHub Desktop.
HTML Templates
<html>
<body>
<template id="my-template">
<h1>Hello world from template!</h1>
</template>
<div id="parent">
</div>
<script>
let template = document.getElementById("my-template").content.cloneNode(true);
document.getElementById("parent").appendChild(template);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment