Jquery Get each image src

0 votes

I have a series of images each with the class "photo";

I want to go through each of these and retrieve the photo source, for use later in an if statement. I have written the below code to do this, but have not been successful:

$.each($(".photo"), function() {
  var imgsrc = $(this).attr("src").length;
  console.log(imgsrc);
});

I am not sure where I have gone wrong here. It seems to make sense to me, but I dont get anything in the console.

Can anyone point me in the right direction?

Aug 11 in Web Development by gaurav
• 18,960 points
180 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
0 answers
0 votes
1 answer

Get checkbox value in jQuery

To get the value of the Value ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,440 points
25 views
0 votes
1 answer

jQuery get value of select onChange

Try this- $('select').on('change', function() { alert( this.value ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,440 points
51 views
0 votes
1 answer

jQuery get value of select onChange

To get the value and text of ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,440 points
34 views
0 votes
1 answer

Get checkbox value in jQuery

if you have set a class or id for it, you ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,440 points
45 views
0 votes
1 answer

jQuery get value of selected radio button

Input Radio value Property Get the value of ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,440 points
342 views
0 votes
1 answer

jQuery find all elements with class beneath parent, even in children elements

Remove > from your select $(".parent .searchEl"). You can use the .find() method ...READ MORE

answered Jun 7 in JQuery by Edureka
• 13,640 points
459 views
0 votes
0 answers

jQuery find and replace string

I have somewhere on website a specific ...READ MORE

Jun 10 in JQuery by gaurav
• 18,960 points
160 views
0 votes
0 answers

Getting a jQuery selector for an element

In psuedo code, this is what I ...READ MORE

Aug 11 in Web Development by gaurav
• 18,960 points
28 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,510 points
322 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP