Created
May 22, 2023 19:21
-
-
Save edsu/602a434680832c950b8c303f2685f8b7 to your computer and use it in GitHub Desktop.
Small example of a template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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