Skip to content

Instantly share code, notes, and snippets.

@mike-north
Created March 11, 2015 07:48
Show Gist options
  • Save mike-north/05dcfd6338df60d253bf to your computer and use it in GitHub Desktop.
Save mike-north/05dcfd6338df60d253bf to your computer and use it in GitHub Desktop.
Adding a template to the DOM
<template id="something">
<h1>Hello, world!</h1>
</template>
var tmpl = document.querySelector('#something');
var tmplClone = document.importNode(tmpl.content, true);
document.body.appendChild(tmplClone);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment