Hello have this bit of code
var imgName = document.createTextNode(currentCard.getElementsByTagName("tnail")[0].firstChild.data);
var imgElem = document.createElement("img");
imgElem.setAttribute("src", ".imgs/core/" + imgName);
imgElem.setAttribute("height", "75");
imgElem.setAttribute("width", "75");
imgElem.setAttribute("alt", "gtdi");
backCard.appendChild(imgElem);
newCard.appendChild(backCard);
console.log(imgName);
the console.log gives me correct name of the image i place in the xml doc. kitten.png.
but when so far when i go to add it to the path on the code of line with:
imgElem.setAttribute("src", ".imgs/cFolder/" + imgName);
I get the error message:
http://localhost/jscoding/.imgs/cFolder/[object%20Text] 404 (Not Found)
so I see two issues, one. I have not managed to escape the the " delimter & two I don’t see why the console log will give me the right name but other experiments still give me a [object Text]
& getting the kitten.png from an xml file
thx