var shownImg = document.getElementsByTagName("img");
I am looking to replace this line with something that checks the previous node and looks for the “img” in the html that is part of the json response.
This is the full code:
const response = [];
let myOwnImgs= ['HXXP://example.com/aaa/aaaa/aaa/789.jpg', 'HXXP://example.com/aaa/aaaa/aaa/101.jpg']
var shownImg = document.getElementsByTagName("img");
for(var i =0; i< shownImg.length; i++){
shownImg[i].src = myOwnImgs[i] // updating main image with array image
shownImg[i].alt = myOwnImgs[i].slice(-7) // for verifying
}
response.push({
json: {
shownImg,
}
})
return response;
basically, I feel like it should be something like
var shownImg = **REFERENCE TO JSON NODE HERE** .getElementsByTagName("img");
and I need to also replace this with an array list from the previous json node
let myOwnImgs= ['HXXP://example.com/aaa/aaaa/aaa/789.jpg', 'HXXP://example.com/aaa/aaaa/aaa/101.jpg']
or something close to that, any ideas?