6/14 what did i do wrong?


#1

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


#2

Hi,

when using "addClass" you do not need the . as a class identifier, its different to selecting something by class name

Thanks

Keith


#3

https://api.jquery.com/addclass/


#4

I don't understand this. I wrote many times like this and only 10 time worked. I don't understand how Jquery works.

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

});

What is wrong?


#5

@webmaster72760,

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#6

then what goes with the addclass nothing?


#7

nothing your code works i tried it out and it works try reloading it