Source Code:
(back to article)
Submit
Result:
Report an issue
<div> <template id="my-template"> <style> p { color: red; } </style> <p>This is a template content</p> </template> <script> const template = document.getElementById('my-template').content; document.body.appendChild(template.cloneNode(true)); </script> </div>