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

Trying to make an image slider, my script .addClass wont work?

for some reason the console is giving me an error on the .addClass function ive created... heres my code

https://w.trhou.se/wt172ll8eh

1 Answer

Chuck Emory
Chuck Emory
14,476 Points

Dylan,

I'm thinking that it has to do with this line of your code: var image = ($("img")[count]);. Since you are using jQuery, you may want to look into using the .eq() function. Using .eq() should help you specify the correct image when you click on #next. $("img").eq(count)