6. Adding and Removing Classes



Code is accepted; however, if I do not put a ' # ' in front of 'text', I will get an ERROR message: Oops, try again. It looks like your #text doesn't have the class .highlighted. Check the Hint if you need help! "

I am confused, because in the exercise, it clearly states: "Remember: You aren't selecting anything, you are modifying your element. This means that you do NOT need # or . before your class.".

Why do the instructions say I do not need #, but if I don't put # the code is not accepted?

$(document).ready(function() {
    $('#text').click(function() {


The statement refers to,

Learners often mistakenly include a dot in this expression. You have not, which is correct.


Ohhh. Got it. I forgot text is an ID, not a class. Thank you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.