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 trialSandy Kovacic
3,958 PointsJQuery code to hide the dive and the id "message" and then show it slowly by passing in the string "slow".
Hi,
The answer that was accepted from me was : $("#message").hide().show("slow");
Yet the video shows that a div can be referenced in a jQuery statement with a . not a # and when you look at the HTML with the chrome tool it shows the div being referenced with a .
Can you tell me why this is so?
Kind regards
Sandy
9 Answers
Omar Zeidan
8,893 PointsCan you explain more Sandy Kovacic, I can't exactly get it .?
Sandy Kovacic
3,958 Points$("#message").hide().show("slow"); vs $(".message").hide().show("slow");
Does # select an element and . select a class?
Sandy Kovacic
3,958 Points$("#message").hide().show("slow"); vs $(".message").hide().show("slow");
Does # select an element and . select a class?
Adam Sackfield
Courses Plus Student 19,663 PointsSelects an ID and . selects a CLASS. An element can be selected with the element name eg
$('form');
Adam Sackfield
Courses Plus Student 19,663 PointsIn your code
$("#message").hide().show("slow");
Your referencing an element with an ID of "message". You can target what ever you want here a few example
$('div');
$('a');
$('.className');
$('a[type="text"]');
And so on
Adam Sackfield
Courses Plus Student 19,663 PointsThe HASH'#' is to ref an ID
Adam Sackfield
Courses Plus Student 19,663 PointsThe HASH'#' is to ref an ID
Omar Zeidan
8,893 PointsYes, I guess Adam gave you the answer you want. As he mentioned that we have different ways to manipulate the DOM and to access what we need.
If you want any more clarification I will be happy to help.
Adam Sackfield
Courses Plus Student 19,663 PointsIs this forum going insanely slow for anybody else?
Omar Zeidan
8,893 PointsYes, sometimes, specially when you edit your answer, subscribe and unsubscribe!
Sandy Kovacic
3,958 PointsOkay, thanx guys.