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

HTML HTML Forms Choosing Options Checkboxes

Multiple selections vs. limited/single selections

In the Radio Button section we learned that when the 'name' attributes are the same, you get single selection scenario (i.e. can select one or the other option, but not multiple selections).

Now in the Check Box section, the 'name' attributes are the same, yet I can select (check) all that apply (i.e. can have multiple selections). It seems to work when the 'name' attributes are the same and when they're modified.

Is this due to 'checkbox' behavior?

In other words, use radio buttons when you may want to control the selection options (1 or multi) and use checkboxes when you don't want to limit the number of selections a user can make?

actually...just rewatched the lesson and yes that is why you want to use check boxes. (must get more sleep)

1 Answer

Steven Parker
Steven Parker
229,644 Points

You're exactly right.

This also makes the UX more familiar to most users, as they will expect radio button behavior to be exclusive but check-boxes to work independently.