Home » Web (page 4)


Get References from HTML Built with Template Literals

One thing JavaScript template literals are great at is little blocks of HTML. Like: // Probably from some API or whatever const data = { title: "Title", content: "Content" }; const some_html = ` <div class="module"> <h2>${data.title}</h2> <p>${data.content}</p> </div> `; But that’s still just a string. It’s not ready to append to the DOM just yet. And what if we ...

Read More »

Powered by WP Robot