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 jQuery Basics (2014) Creating a Simple Drawing Application Perform: Part 1

Kevin Faust
Kevin Faust
15,353 Points

theres no background-color in the "selected' class???

in the first line where we declare the variable 'color', we are taking the background-color from the selected class but in the css it looks like this:

.selected {
    border: 7px solid #fff;
    width: 40px;
    height: 40px;

see theres no background-color so i dont really understand

1 Answer

Hey Kevin,

You're talking about this line?

var color = $(".selected").css("background-color");

If so, all it does is grab any element that has a class of selected and get that element's background-color. So here,

<ul>
    <li class="red selected"></li>
    <li class="blue"></li>
    <li class="yellow"></li>
</ul>

It grabs the background color of that li element that has the class of selected and stores it in the variable color.

Kevin Faust
Kevin Faust
15,353 Points

thanks mikis. makes sense now

No problem. Good luck with your learning Kevin.