I am using jquery to try and get the img src of a bunch of imgs in a div and storing the values as per code below... but i am getting undefined as the output of the variable newHomeHeroCarouselFetchedIMGSRC
- can anyone help as to why?
$('.newHomeHeroCarouselFetchedIMGs img').each(function() {
let newHomeHeroCarouselFetchedIMGSRC = $(this).attr('data-src');
console.log(newHomeHeroCarouselFetchedIMGSRC);
});
Example of markup of the newHomeHeroCarouselFetchedIMGs
div is below:
<div class="newHomeHeroCarouselFetchedIMGs">
<img src="https://www.example.com/image1.jpg">
<img src="https://www.example.com/image2.jpg">
</div>