English

Consider the following form control in an HTML form: ☆ Male ☆ Female Now choose the correct line of code for the above:

Advertisements
Advertisements

Question

Consider the following form control in an HTML form:

☆ Male
☆ Female

Now choose the correct line of code for the above:

Options

  • <input type = "radio" name= "Gender" value= “male">Male<br>
    <input type = "radio" name= "Gender" value= "female">Female<br>
  • <input type = "radiobutton" name = "Gender" value= "male">Male<br>
    <input type = "radiobutton” name = "Gender" value= "female”>Female<br>
  • <input type = "radio", name = "Gender">< value= "male">Male
    <input type = "radio”, name = "Gender">< value= “female”>Female
  • <input type = "radio" name= "Gender"value= "male"><br>
    <input type = "radio" name= "Gender" value = "female"><br>
MCQ
Advertisements

Solution

<input type = "radio" name= "Gender" value= “male">Male<br>
<input type = "radio" name= "Gender" value= "female">Female<br>

Explanation:

To make two mutually exclusive choices (Male/Female), you give both inputs the same name attribute (here name="Gender"); that groups them so only one can be selected at a time. Each input should have an appropriate value attribute (e.g., value="male" and value="female"). Option (a) shows the correct syntax and grouping.

shaalaa.com
  Is there an error in this question or solution?
Chapter 5: HTML- III: Audio, Video and Forms - Assisted Practice [Page 229]

APPEARS IN

Sumita Arora Computer Applications [English] Class 10
Chapter 5 HTML- III: Audio, Video and Forms
Assisted Practice | Q 10. | Page 229
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×