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.

carine todmia
6,071 Pointsi thought $(".selected") was considered improper syntax for jquery
i know in plain javascript i can add the .selected to identify a class but i was almost sure when writing jquery you dont include this. Can someone help me with this understanding or am i confusing this with some other rule?
2 Answers

Pavle Lucic
10,801 Pointscarine todmia hi,
Maybe you get confused by this code
$(".selected").removeClass("selected");
The first part $(".selected") - it is Jquery selector (almost same as you would select elements in CSS). It selects html element with class selected and create jquery object from him.
Another part is .removeClass("selected") - it is Jquery method (there is not dot at the end). So every object can have methods. This method removeClass, removes class selected from $(".selected") html element.

David B Dinkins
71,472 PointsThe $("")
syntax is the most common way of selecting the elements in the DOM with jQuery. You can use it to select an element using HTML tag names the way you do in CSS:
$("div a:link").show();
You can also use it select an element by its class or id:
$(".selected").hide()
// or
$("#form-submit").hide().
carine todmia
6,071 Pointscarine todmia
6,071 Pointsso what is the actual object in this case
Pavle Lucic
10,801 PointsPavle Lucic
10,801 Points$(".selected") - It is a object.