Skip to content

connoroffutt/switch-jquery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The Switch

You Assignment

Given the HTML and CSS as provided, use jQuery to hear the click of the switch and meet the following criteria:

  • When someone hits the button in the switch, remove the current state class (on/off), and apply the opposite class (on/off)
  • Swap the colors of the body's background and text by adding or removing the dark/light class
  • Lastly, change the text in box to say "It's so bright in here!" when it's on, and "Hey, who turned off the lights?" when it's off

Hints

Start with small steps:

  1. Change the status text when the document is ready
  2. Add a click listener to the switch and incorporate the changes listed above in 'Your Assignment'
  3. Confirm the switch works
  4. How do we switch the classes back now?
  5. First try it with a regular javascript if statement
  6. Then try it with the jquerytoggleClass function

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published