jQuery question - why do I need "." before some selectors but not others?

jQuery question - why do I need "." before some selectors but not others?
0

#1

So I’m working my way through the first set of classes here, and we’re just getting into jQuery. The code I was instructed to add to my jQuery Playground is as follows:


When I was instructed to add the $(".well") selector, there was a note saying “Note that, just like with CSS declarations, you type a . before the class’s name.”

However, I was not instructed to add a period before the $(“button”) selector. Can anyone explain to me what the difference is, and why one requires the period but the other does not? Just trying to wrap my head around this. Thanks!


#2

I think it’s because .well is a bootstrap CSS class, but button is an HTML element.


#4

Ahhhhhh. Ok. It’s still a bit confusing, but that makes more sense now. It would have been helpful if there had been an extra note in the course explanation saying “Note that because we are selecting a class we type a “.” before the class’s name, whereas previously we were selecting an element

I think I’ve got that right?

Thanks so much for your help!