The properties on the
Following along in Safari?
There is a bug in Safari that prevents this code from running correctly. Safari won't let you declare a variable with the same name as an ID present in the DOM. Because the variable
toggleList shares the same name as the ID for the button it references on the first line, this code won't run in Safari. This behavior only happens with the
let keywords, not
If this is affecting you, there are a few ways to proceed:
- Use an alternative web browser, such as Google Chrome or Mozilla Firefox.
- Use the
varkeyword to declare the
toggleListvariable. Like this:
var toggleList = document.getElementById('toggleList');
- Change the name of the variable to something like
toggleListButton. Like this:
const toggleListButton = document.getElementById('toggleList');
Don't forget to use the variable name you choose for every instance of that variable throughout the document.
You need to sign up for Treehouse in order to download course files.Sign up