Home > Enterprise >  can anyone help me with this problem about radio button
can anyone help me with this problem about radio button

Time:01-25

when I run this code, its not a radio button like i can click all the 2 button and i cannot remove a click <!DOCTYPE html> <html> <title>abc</title> <body> <h1>Input Form</h1> <form action="abc"> <input type="radio">abc <input type="radio">hwqwhdwq </form> </body> </html>

im a highschool student, imtrying some course in udemy and come accross this problem. I hope someone can help me figure out what im wrong

CodePudding user response:

If I understood you well, I think you're trying to SELECT only one radio checkbox not both right? if yes then this is how to do it, add name="" attribute and set the same name to both of them.

<body>
  <h1>Input Form</h1>
  <form action="abc"> <input type="radio" name="btn">abc <input type="radio" name="btn">hwqwhdwq </form>
</body>

CodePudding user response:

i think you have to do this 
    <!DOCTYPE html> 
    <html> 
    <head>
        <title>abc</title> 
    </head>
    <body> 
        <h1>Input Form</h1>
        <form action="abc">
            <label for="radio1"><input type="radio" name="radioBtn" id="radio1"> Radio    1</label>

            <label for="radio2"><input type="radio" name="radioBtn" id="radio2"> Radio 2</label>
        </form>
    </body>
    </html>

CodePudding user response:

Registration form

Male
        <label for="female"><input type="radio" name="Gender" id="radio2" value="female">Female</label>
    </form>
  • Related