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 trialOlga Pavlova
Python Development Techdegree Student 2,795 PointsItems not being checked
<div class="grid-80">
<input type="radio" id="no_{{ category }}_icon" name="{{ category }}" value='' {% if not saves.get(category) %}checked{% endif %}>
<label for="no_{{ category }}_icon"><img src="/static/img/no-selection.svg"></label>
{% for choice in choices %}
<input type="radio" id="{{ category }}-{{ choice }}_icon" name="{{ category }}" value="{{ choice }}" {% if saves.get(category) == choice %}checked{% endif %}>
<label for="{{ catogory }}-{{ choice }}_icon"><img src="/static/img/{{ category }}-{{ choice }}.svg"></label>
{% endfor %}
</div>
I follow the video (without understanding a lot) but it doesn't work as it should. Selected items not being checked.
1 Answer
Rohald van Merode
Treehouse StaffHey Olga Pavlova 👋
It looks like you have a typo in the value of the for
attribute on your label for the choices. It says catogory
instead of category
, because of this it's not correctly associated with the radio input and therefor the input is not getting checked correctly when an image is being clicked 🙂
Hope this helps to get you going again! 😄
Olga Pavlova
Python Development Techdegree Student 2,795 PointsOlga Pavlova
Python Development Techdegree Student 2,795 PointsThanks Rohald, it works!!!