7. Toggling Classes


#1


This is the error message: Oops, try again. Did you replace your .addClass() with a .toggleClass()?

Another thing I've noticed is that .toggleClass doesn't change colors like .addClass did, and I think there may be a problem that I'm not seeing


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


#2

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

you should use #text or this instead of div .

we don't want .toggleClass for all the div elements .


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.