Add and delete class


#1

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

It's not correct.Who can help me ?


#2

can you post the exercise url? I can't find the exercise

if you want to select by class, there should be dot (.) before text:

$('.text').click(function() {

for more help i need to see the exercise


#3

https://www.codecademy.com/fr/courses/web-beginner-fr-FR-3zko8/1/1?curriculum_id=5355c479516bcbd91200000d#


#4

lets look at this line first:

$('text').click(function()

the click event should be added to div with id of text, to add a click event to an id the selector should start with a # (so #text)

then here:

$(this).highlighted.('text');

you need to add a class (addClass) named highlighted, so addClass is the jquery function you need to use and highlighted then name of the class:

$(this)jqueryFunction('className');

then don't forgot to follow the full screen instructions, if problems persist post an updated version of your code


#5

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

The blue text is highlighted but it tells me that I made a mistake

(Google translate)


#6

so now you made the correct code:

$(this).addClass('highlighted');

you can remove the faulty code:

$(this).highlighted('text');

then submit, and follow the full screen instructions


#7

Thank you for your help :innocent:


#8