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

$Overlay??? Creating jQuery representations of objects

In Perform Part: 2 the instructor creates a jQuery representation of the object:

var overlay = '<div id="overlay"></div>';

..by wrapping it in parenthesis and adding a dollar$ to it:

var overlay = $('<div id="overlay"></div>');

My question is simply why? What is the point of even doing this. If you appended the

'<div id="overlay"></div>'

to any part of the DOM without making it a jQuery representation would it not also work just as well?

Hey Tyler, As i know it is the basic rules of jquery for selecting element whether we want to append them or making an event on it ..!

check out here actually what is it http://www.w3schools.com/jquery/jquery_syntax.asp