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!
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
Farid Lavizadeh12,005 Points
Why is 'captionText' not put as a jQuery representation?
Why is 'captionText' not put as a jQuery representation? In other words why doesn't it have a $ sign next to it?
Caption text isn't a JQuery representation of an object, It's a simple string, no more. If you want to see it alive I setted up this little jsfiddle. Just open your console by pressing F12 and run the code. This will become obvious then.
Sean T. Unwin28,688 Points
captionText is a variable that's value the text of the clicked image's
alt attribute. Therefore, it doesn't need to be a jQuery object.
I have answered another question from this lesson that may be a tangent of this question. Perhaps it may help make things a little more clear.