"Adding and Removing Classes" DOESNT WORK, WHY?


#1

$(document).ready(function() {
$("#text").click(function() {
$(this).addClass(".highlighted");
});
});


#2

you did this in the html course? did you include a jquery library?


#3

no i didnt, but i also didnt include in other exercide and its work.
is it posted code good?


#4

this is my html code, javascript tag in head tag is there so its connect html with jQuery by defoult.









I'm highlighted!

Highlight me, too!



#5

your jquery code isn't good, addClass should only contain the classname, not the dot (highlighted not: .highlighted)

if you edit/update your question, leave a reply so i get a notification. Your html code is not visible, take the following steps to make your code visible:

if this instructions are unclear, you can also insert 3 backticks before and after your code, like so:

```
<p>visible</p>
```

the backtick is located above the tab key on your keyboard


#6

A post was split to a new topic: 6.Adding and Removing Classes


#7