Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,266 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,266 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