An Interest In:
Web News this Week
- May 1, 2024
- April 30, 2024
- April 29, 2024
- April 28, 2024
- April 27, 2024
- April 26, 2024
- April 25, 2024
November 8, 2018 11:44 pm GMT
Original Link: https://css-tricks.com/get-references-from-html-built-with-template-literals/
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 need references to those elements inside somehow?
that are in this vein: lit-html…
The post Get References from HTML Built with Template Literals appeared first on CSS-Tricks.
Original Link: https://css-tricks.com/get-references-from-html-built-with-template-literals/
Share this article:
Tweet
View Full Article