O'Reilly logo

HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition by Bruce Hyslop, Elizabeth Castro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Radio Buttons

Remember those old-time car radios with big black plastic buttons—push one to listen to WFCR; push another for WRNX? You can never push two buttons at once. Radio buttons on forms work the same way (except you can’t listen to the radio).

Image The name attribute serves a dual purpose for radio buttons: It links the radio buttons in a given set, and it identifies the value when it is sent to the script. The value attribute is crucial, since the visitor has no way of typing a value for a radio button.

<fieldset class="radios"><ul>     <li>        <input type="radio" id="gender_male" name="gender" value="male" />        <label for="gender_male">Male</label> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required