Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

troy beckett
troy beckett
12,035 Points

image src

I'm trying to play around with image src to make a gallery. Thing is I seem to be running into the same problem.

say my images src="large.jpg" when I check in the console it comes up with loads of numbers in front like:

//124.1.1.78885/img/large.jpd

and this seems to be causing me lots of problems for some reason.

Jeff Lemay
Jeff Lemay
14,268 Points

This should be giving you just what is put inside the src. Sounds like you are using something else.

$('img').attr('src');
troy beckett
troy beckett
12,035 Points

jeff this is exactly what I've been writing but I constantly get all these numbers infront and it causes massive problems for some reason.

Jeff Lemay
Jeff Lemay
14,268 Points

Hmm.. never seen that before and a quick google search didn't provide any answers. Hopefully someone else pops in this thread to help you out.

troy beckett
troy beckett
12,035 Points

yeah its wierd cos the thing is my friends computer doesn't do that.

1 Answer

Colin Bell
Colin Bell
29,679 Points

Can you post your code in a codepen or jsbin?

jsbin example of getting img src