HTML Radio

Radio button allow the user to select the only ONE of limited number of choices.We set the type attribute of the <input> tag to "radio".<input type="radio"/>.Here i show you with the example,now see

Example:
<form name="HTML Form" action="mailto:youremail@email.com" method="post">
<h4>select your favorite food.</h4>
<input type="radio" name="food" /> : Italian<br />
<input type="radio" name="food" /> : Indian<br />
<input type="radio" name="food" /> : Chinese<br />
</form>


Your Result:

select your favorite food.

 : Italian
 : Indian
 : Chinese
here you can select only food category.Here is another example now see
Example:

<form name="HTML Form" action="mailto:youremail@email.com" method="post">
<h4>Select your favorite food.</h4>
<input type="radio" name="food" /> : Italian<br />
<input type="radio" name="food" /> : Indian<br />
<input type="radio" name="food" /> : Chinese<br />
<h4>Select your gender.</h4>
<input type="radio" name="gender" /> : Male<br />
<input type="radio" name="gender" /> : Female<br />
</form>

Your Result:

Select your favorite food.

 : Italian
 : Indian
 : Chinese

Select your gender.

 : Male
 : Female
HTML radio the Checked  Attribute
when we use the checked attribute ,we adjust the form and when we load the form the form will always load with already  checked by default.
Example:

<form name="HTML Form" action="mailto:youremail@email.com" method="post">
<input type="radio" name="food" checked="yes" /> : Italian<br />
<input type="radio" name="food" /> : Indian<br />
<input type="radio" name="food" /> : Chinese<br />
</form>

Your Result:
 : Italian
 : Indian
 : Chinese

No comments:

Post a Comment