What's wrong on Modifying HTML Elements 7/14


#1

$(document).ready(function() {
$('#text').click(function() {
$(this).toggle('#text');

    });

});


#2

By click on the id #text you wanna toggle a class.
That means we should use $(this).toggleClass(NameOfClass);


#3

i am on the same exercise and my code toggles correctly in the preview window, but i cannot continue, it still says try again even though the code works :frowning:

$(document).ready(
    function()
    {
        $("div#text").click(
            function()
            {
                $("div#text").toggleClass('highlighted');    
            }
        )
    }
);

#4

Hi it is not necessary to type

$("div#text")

It is enough if you type

$("#text")

and than type

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


#5

wow that is so annoying... so working code that is written properly is not accepted, but code that is written vagely is -.- there're so many ways to shorten it e.g. lambda but this is an excersise. Codeacademy feels so beta.