I’m trying to create a modal window for the marketplace items but nothing is popping up. I followed the tutorial and used the repository provided on github. I created a button on the navigation bar <a class="nav-link" id="btnMarketPlace" href="#">Marketplace</a>
on the navigation bar which links to const openRenderItemButton = document.getElementById("btnMarketPlace"); openRenderItemButton.onclick = renderItem;
renderItem = (item) => {
const itemForSale = marketplaceItemTemplate.cloneNode(true);
if (item.sellerAvatar){
itemForSale.getElementsByTagName("img")[0].src = item.sellerAvatar.url();
itemForSale.getElementsByTagName("img")[0].alt = item.sellerUsername;
}
itemForSale.getElementsByTagName("img")[1].src = item.image;
itemForSale.getElementsByTagName("img")[1].alt = item.name;
itemForSale.getElementsByTagName("h5")[0].innerText = item.name;
itemForSale.getElementsByTagName("p")[0].innerText = item.description;
itemForSale.getElementsByTagName("button")[0].innerText = `Buy for ${item.askingPrice}`;
itemForSale.getElementsByTagName("button")[0].onclick = () => buyItem(item);
itemForSale.id = `item-${item.uid}`; $('#userItems').modal('show');
itemsForSale.appendChild(itemForSale)
};
I added the modal just below of itemsForSale.appendChild(itemsForSale)
$(’#itemsForSale’).modal(‘show’);
But no modal or items are showing up. Can someone guide me with this please...