My Code Looks Right, But It Does Not Work



<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
My code seems to be correct, but the browser doesn’t translate it, so I cannot move on.


Replace this line with your code.
(document).ready(function() { (’#text’).click(function() {

<do not remove the three backticks above>


so now your class of text element is .highlighted, so if you know want to select this in css you get ..highlighted


I still do not understand.


you add a class .highlighted to your element, you should add a class of highlighted to your element


The syntax example that is provided is not clear in explaining that the “.” is unnecessary following the .addClass function. See below. In the example the proper syntax for the selector is $(’#text’) the ID indicator is included, whereas the Class indicator “.” is omitted.

('selector').addClass('className'); (‘selector’).removeClass(‘className’);

This is the type of inconsistency really needs to be spelled out for newer programmers.


but in the example you can see the full stop being omitted:

The syntax looks like this:


And nothing is stopping learners from checking the official jquery docs

but it makes sense, in the selector we need to specify if we are dealing with element, class or id. addClass will add a class, so adding the full stop is not need


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