Answer the question
In order to leave comments, you need to log in
How to insert into HTML document with JS variables?
There is this code:
var item;
function addItemInOrder (button){
var item = button.closest(".main__categoties-wrapper__categorie-item");
var itemImg = item.querySelector("img");
var itemName = item.querySelector(".main__categoties-wrapper__categorie-item__tittle");
var itemVendorCode = item.querySelector(".vendor-code");
var itemPrice = item.querySelector(".item-price").innerText;
var itemResult = `<div class='order-item'><div class='order-item__data-left'><div class='order-item__data-left__img'>${itemImg}</div><div class='order-item__data-left__item-data'>${itemName}${itemVendorCode}</div></div><div class='order-item__data-right'><div class='order-item__data-right__delete-item'><button class='delete-item'>Удалить</button></div><div class='order-item__data-right__item-price'><h3>Цена: ${itemPrice}р</h3></div></div>`
document.querySelector(".main__order-items-wrapper").innerHTML(itemResult);
}
Answer the question
In order to leave comments, you need to log in
not written correctly
document.querySelector(".main__order-items-wrapper").innerHTML(itemResult);
document.querySelector(".main__order-items-wrapper").innerHTML = itemResult;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question