Can't grab dynamically created elements via querySelector using insertAdjacentHTML

I’m trying to grab an element from page and add an addEventHandler to it. Element (link with class .catalog__link) was dynamically created in another external function when the page was loaded using insertAdjacentHTML. I invoke them both in third js file via import keyword. Everything loads perfectly on the page, the elements are created for… Read More Can't grab dynamically created elements via querySelector using insertAdjacentHTML

How can I render html with insertAdjacentHTML

How can I render components with pure javascript? I used insertAdjacentHTML and forEach to render a list with objects but the objects appeared undefined. object list const liRender = document.getElementById(‘ul-component’) function render() { itens.forEach(() => { liRender.insertAdjacentHTML("afterbegin", ` <li class="products-list__item"> <div class="products-list__item-thumbnail"> <img class="product__thumbnail" src=${itens.img}> <div class="products-list__item-main-content"> <h4 class="product__name"> ${itens.modelo} </h4> <p class="product__description"> ${itens.description} </p>… Read More How can I render html with insertAdjacentHTML