DEV Community

Discussion on: Vanilla JavaScript and HTML - No frameworks. No libraries. No problem.

Collapse
 
nomaed profile image
Nomæd

In the last example, you placed const template = document.getElementById('hero-template') inside the loop.
Is the template content itself being modified after importing it, or can the template be queried only once before the loop?

Collapse
 
john_papa profile image
John Papa

Nice catch. Yes, you can get the template outside (before) looping. I'll move that, that's a good move.Thanks