I want to achieve the effect of clicking and switching pictures, but I will report an error. I hope my friends can take a look at it. Thank you.
/**
*
* @description
* @param {*} clickedImgElement
*/
function setImg(clickedImgElement) {
console.log("clicked image source:" + clickedImgElement.src);
if (clickedImgElement.className === "nav-img") {
console.log("nav-img class is cliked");
clickedImgElement.src = SWITCH_URL;
}
}
originally intended to switch images by changing the img.src property, but Chrome will report the following error. How should I modify it? Asynchronous setting?