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

Python

what does 'checked' do?

Hi,

In this part Mr. Kenneth puts 'checked' inside the input element and in between the if blocks, could someone please elaborate on what it does specifically, I am not familiar with this JinJa2 syntax but I believe it has to do something with the CSS

Thank you!

<input type="radio" id="{{ color }}" name="colors" value="{{ color }}"
{% if saves.get('colors') == color %}checked{% endif %}>
 <label for="{{ color }}"></label>

mouseandweb Hi, here it is posted :) thank you for your interest in my question

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

It looks like it's adding a checked attribute that styles what the form looks lime when the radio box in question is "checked" i.e. in focus.