Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Why do you have to set the list items class name to empty and full.

Why do you have to set the list items class name to empty and full.

Why can't to set it to any other string

HTML += '<li class="empty">'; } else{ HTML += '<li class="full">';

1 Answer

If you are doing the lesson that creates the little tiny red/green bullets on the side of the page, you are doing these settings because there is already CSS written for those specific classes. I believe it was a lesson where you were setting whether or not someone was in/out and then if an office was empty or full.

If not, there is no reason you have to set class names to anything specific. They are there to allow you either style them more easily or to grab them with JS/jQuery.