English subtitles

← Toggling Classes Quiz - Intro to jQuery

Get Embed Code
6 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. To start off, I created variables for article two and article three.
  2. Article two got set equal to this jQuery selector for the class featured, and
  3. then I set article three to the next sibling of article two.
  4. Then, all I did was toggle the class of featured on article two and
  5. article three.
  6. I hit Test Run.
  7. And, let's see how it looks.
  8. We can see that now article three has a blue background while article two
  9. does not.
  10. Looks like it worked.
  11. This shows that toggleClass will either add or
  12. remove a class depending on whether or not it's already there.