I have created two HTML pages. But I am not getting element of second HTML page in JavaScript event listener.
My goal : Whenever anybody click on any product its picture, title and description replace with the image, title and description of single product page. first HTML page second HTML page
product.forEach(function (products) {
products.addEventListener("click", function (curr) {
location.href = "http://127.0.0.1:5500/single.html";
// element of first html page
let productImg = curr.currentTarget.firstElementChild.firstElementChild;
// element of second html page
let img = document.querySelector(".sp-img");
});
});