Skip to content

Instantly share code, notes, and snippets.

@edsu
Created May 22, 2023 19:21
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 edsu/602a434680832c950b8c303f2685f8b7 to your computer and use it in GitHub Desktop.
Save edsu/602a434680832c950b8c303f2685f8b7 to your computer and use it in GitHub Desktop.
Small example of a template
<html>
<body>
<div id="root" />
<template id="my-template">
<div>
<input type="text" />
<button>Remove</button>
</div>
</template>
<script>
const root = document.getElementById("root");
const form = document.getElementById("my-template").content.cloneNode(true);
root.appendChild(form);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment