both of the radio buttons can be selected

2020-02-13 14:57发布

I have form with 2 radio buttons but both of the radio buttons can be selected,

     <form class="descriptions" id="collection"  method="post" action="">
                          <table width="200">
                              <tr>
                                <td>
                                  <label>Collection</label>
                                  <input type="radio" value="collection" />
                                </td>
                                <td>
                                  <label>Delivery</label>
                                  <input type="radio" value="delivery"    />
                                </td>  
                            </tr>
                         </table>

                </form>

I know this is very easy but I can't seem to find the answer, any help would be appreciated.

标签: html
3条回答
Ridiculous、
2楼-- · 2020-02-13 15:35
  <form class="descriptions" id="collection"  method="post" action="">
                          <table width="200">
                              <tr>
                                <td>
                                  <label>Collection</label>
                                  <input type="radio" name="samename" value="collection" />
                                </td>
                                <td>
                                  <label>Delivery</label>
                                  <input type="radio" name="samename" value="delivery"    />
                                </td>  
                            </tr>
                         </table>

                </form>

// this is the correct answer for ur following problem //

查看更多
Lonely孤独者°
3楼-- · 2020-02-13 15:38

Description of the radio button control type in the HTML 4.01 specification:

Radio buttons are like checkboxes except that when several share the same control name, they are mutually exclusive: when one is switched "on", all others with the same name are switched "off".

查看更多
家丑人穷心不美
4楼-- · 2020-02-13 15:59

Give them the same name.

查看更多
登录 后发表回答