WeCodeAcademy

jQuery CSS and Classes

Use .css() for single styles, but prefer toggling classes so your styling stays in your stylesheet: .addClass(), .removeClass(), .toggleClass(), .hasClass().

Examplehtml
Open in editor »
Quick check

Which method adds a class if it is missing and removes it if present?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.