November 28, 2016
by Lauren K. Jones, Director of Web Development and Design
There are many possible solutions to this coding challenge. The solution shown in the example below is only one possible option.
There were several errors in the original coding challenge:
- The id for the
linktag on line 7 and the id selected on line 42 should have matching capitalization (
anchortags in lines 21-26 are not closed properly (
- The button id for the "Wild" button should be "wild" and not "experiment" in order to match the rest of the code.
- A quotation mark is missing from the
getElementByIdmethod on line 42.
cleanBtnvariable is used on line 50, but is not defined in the code.
- The variable named at the top of the switch statement should be called "stylesheet" and not "style."
- The second case in the switch statement is missing a colon.
expBtnvariable in line 58 should be called
- A comma is missing from the
addEventListenermethod on line 63.
- A semicolon is missing at the end of line 64.
- All instances of the
getElementById()method are written as
getElementByID(), which has incorrect capitalization.
- Extra lines of code need to be added to each case of the switch statement to remove the classes from the buttons that are not selected.
changeCSS()function needs to be called when the page is first loaded in order to select the current style sheet.