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 trialChris Ascencio
8,785 Pointswhy is it that when i click the label the check box doesn't work, but clicking the box does?
Nick displayed that idea when you click a label for a input element the checkbox would activate. BUT im case that doesn't happen.
p.s. i change the css of my form, so that my or may not have something to do with this problem
***here is link***** https://teamtreehouse.com/workspaces/6265222#
1 Answer
Frederico Graciano
Courses Plus Student 2,768 PointsYou need to add the the attribute FOR in the label element tag.
for = id name of the input type checkbox id=...
for is used to assign the label to the input type.
so needs to look like this:
<label for="shipping">Fast Shipping</label><br>
<input type="checkbox" id="shipping" value="fast_shipping"><br>
<label for="newsletter">Subscribe to Newsletter</label><br>
<input type="checkbox" id="newsletter" value="subscribe"><br>