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

HTML Build an Interactive Website Introduction to jQuery Including jQuery in our Project

JQuery 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

Can you explain more Sandy Kovacic, I can't exactly get it .?

$("#message").hide().show("slow"); vs $(".message").hide().show("slow");

Does # select an element and . select a class?

$("#message").hide().show("slow"); vs $(".message").hide().show("slow");

Does # select an element and . select a class?

Selects an ID and . selects a CLASS. An element can be selected with the element name eg

     $('form');

In 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

The HASH'#' is to ref an ID

The HASH'#' is to ref an ID

Yes, 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.

Is this forum going insanely slow for anybody else?

Yes, sometimes, specially when you edit your answer, subscribe and unsubscribe!

Okay, thanx guys.