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 Form Basics The Button Element

when do we use value in forms ?

why and when do we use value attribute in form like in username and password field we dont but when working with check box and radio button we use value

what i thinks is value is use when we want to send data of user selection to server like
<input type ="radio" name = "gender" value = "male">male in this when any one click the radio of male the value of male is sent to server is i am right ?

1 Answer

Steven Byington
Steven Byington
13,584 Points

This way you can see the value of what the user chose, since they are unable to type out a value like in username and password.

thanks you Steven