मराठी

Illustrate the use of the radio button input type on an HTML form with an appropriate code and the corresponding output. - Computer Applications

Advertisements
Advertisements

प्रश्न

Illustrate the use of the radio button input type on an HTML form with an appropriate code and the corresponding output.

थोडक्यात उत्तर

उत्तर

A radio button is defined with the <input type="radio">. Radio buttons are typically displayed as radio groups (a group of radio buttons describing a set of related alternatives). A collection of radio buttons can only have one radio button selected at a time.

Note: To be considered a group, the radio group must have the same name (the value of the name parameter). After creating the radio group, selecting any radio button in that group instantly deselects any other radio button in the same group. You can have as many radio groups as you like on a page, as long as each one has its own name.

Example code:

<html>
<head>
<title> Example of Radio Button</title>
</head>
<body>
<form>
<label>
Gender:
</label> <br>
<input type="radio" id="gender" name="gender" value="male"/> Male
<br>
<input type="radio" id="gender" name="gender" value="female"/> Female <br/>
</form>
</body>
</html>
Output:

Output:

 

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2022-2023 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×
Our website is made possible by ad-free subscriptions or displaying online advertisements to our visitors.
If you don't like ads you can support us by buying an ad-free subscription or please consider supporting us by disabling your ad blocker. Thank you.