Radio button is not working properly

前端 未结 8 467
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 00:48

In my web page I have placed some radio buttons. But these buttons are not working properly. I can check multiple buttons.

code:

相关标签:
8条回答
  • Radio buttons which are grouped together must have the same case-sensitive name property.

    <label for="input1">First Input</label>
    <input type="radio" id="input1" name="inputGroup" >
    <label for="input2">Second Input</label>
    <input type="radio" id="input2" name="inputGroup" >
    <label for="input3">Third Input</label>
    <input type="radio" id="input3" name="inputGroup" >
    

    JSFiddle demo.

    From the HTML specification:

    Radio buttons are like checkboxes except that when several share the same control name, they are mutually exclusive.

    0 讨论(0)
  • 2020-12-10 01:38

    Name them the same way, and in your php or receiving code it will be something like

    $_POST['name'] = 'value of selected radio button'
    
    0 讨论(0)
提交回复
热议问题