On this web page, https://editart2020.crooked.media/collection/fundamentos/, mouse over the first image to see the caption -- it has a comma and the word "by".
I got that with this simple code:
const caption = document.querySelector('.ae-overlay-caption').innerHTML;
caption2 = caption.replace("<br>",",<br>by ");
document.querySelector('.ae-overlay-caption').innerHTML = caption2;
Now when I try to get the other captions to work, I tried this code:
const captions = document.querySelectorAll('.ae-overlay-caption').innerHTML;
for (var i; i < captions.length; i++) {
caption[i] = captions.replace("<br>",",<br>by ");
document.querySelector('.ae-overlay-caption').innerHTML = caption[i];
}
However, the console says that captions is not defined. I don't know why and I've tried many variations of this code, and different for loops, to no avail. Thanks.
",",
by ");`... where is caption comming from? – Lawrence Cherone Aug 10 '20 at 18:39
",",
by "); document.querySelector('.ae-overlay-caption').innerHTML = caption; } I still only get the first one. – user42760 Aug 10 '20 at 18:45
",",
by "); document.querySelector('.ae-overlay-caption').innerHTML = caption; } – user42760 Aug 10 '20 at 18:46