I have a series of images, each with a "photo" class;
I want to go through each of them and restore the source of the photo so that I can use it later in the if statement. To do this, I wrote the code below, but was not successful:
$.each($(".photo"), function() {
var imgsrc = $(this).attr("src").length;
console.log(imgsrc);
});
I'm not sure where I made a mistake here. This seems to make sense to me, but I'm not getting anything in the console.
Can someone point me in the right direction?
source
share