logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Clairvoyance: 08:00 PM

Full Schedule
g
g HTML Site

BellaOnline's HTML Editor

g

The HTML Form - Radio Button and Checkbox Input Tags - 2

Guest Author - Diane Cipollo

In the first section of this tutorial we discussed how the radio input tag works. Now let's take a look at the code.

Let's take a look at an example of one of the three radio input tags used in the previous example.

<input type="radio" name="color" value="Red"> Red
<input type="radio" name="color" value="White"> White
<input type="radio" name="color" value="Blue"> Blue
What Does The Code Mean
< Left angle bracket
input The element name
typeThe type attribute is set to radio to create a radio button (type="radio").
nameThe name attribute is used to set an identification for the input field. In order for the radio input tags to work as a group, you will need to set the name attribute to the same for all of the radio tags in the group (name="color").
value The value attribute is used to set the value for each radio button in the group. Each of the radio tags will have the value attribute set to a different value. For example, if you want the user to choose between Red, White and Blue; you would have three radio buttons with the value attribute set to a different color for each.
checkedThe checked attribute is used to set one of the radio buttons as selected by default when the webpage form is displayed on the webpage.
>Right angle bracket
  1. As you can see, these radio input tags can work together as a group because they all have the same value for the name attribute (name="color").
  2. It is the value attribute that determines the value of each individual radio button. In the example, we have three radio buttons with their value attributes set to Red, White and Blue.
  3. If we wanted one of the radio buttons to be selected when the form displays on the webpage (i.e. by default) we would include "checked" within that radio input tag.
In the next section of this tutorial we will discuss the checkbox input tag.

← Back | Next →




This site needs an editor - click to learn more!

Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Twitter Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Facebook Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to MySpace Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Del.icio.us Digg The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Yahoo My Web Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Google Bookmarks Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Stumbleupon Add The+HTML+Form+%2D+Radio+Button+and+Checkbox+Input+Tags+%2D+2 to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the HTML Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
What's Coming in HTML 5

What is FTP?

HTML Fundamentals - Tables

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor