Adding and Removing Classes


#1



https://www.codecademy.com/courses/web-beginner-en-v6phg/1/1?curriculum_id=50a3fad8c7a770b5fd0007a1#

Oops, try again. Please follow the instructions on the Full Preview page to test your code.

I ran this code, the text was highlighted before I clicked on it. Not sure what I am doing wrong.
I followed the hint in the exercise and I looked at zystvan's solution.

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

Continuing the discussion from 6. Adding and Removing classes:


#2

Your jQuery code is fine and with this jQuery code it shouldn't be highlighted before clicked on so probably an error in HTML or CSS ..

Please paste in your HTML and CSS code


#3

3 posts were split to a new topic: Exercise doesn't work for me right now