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 trialFarid Lavizadeh
12,006 PointsWhy 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?
2 Answers
geoffrey
28,736 PointsCaption 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. Unwin
28,690 PointscaptionText
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.