Click multiple choice questions
笑书神侠
笑书神侠 2017-07-14 17:49:45
0
2
1468

<input type="radio" name="gender" id="male"><label for="male">male</label>

<input type= "radio" name="nvde" id="nv"><label for="nv">female</label>

This is what I wrote, but when one is selected, the other state No change, what did I write wrong?

笑书神侠
笑书神侠

reply all(2)
ringa_lee

Radio is a single option, and the names in it must be consistent. Your name="gender" above and name="nvde" below are equal to two single options. Of course, the status of the other one remains unchanged

Peter_Zhu

The correct syntax should be written like this:

<label for="male">男</label>
<input type="radio" name="sex" id="male" />
  
<label for="female">女</label>
<input type="radio" name="sex" id="female" />

Because the radio button control can only select one at a time, no matter how many radios there are, their name attribute values ​​must be the same, so as to ensure that only one value is passed to the server deal with.

In your code, the first line, name="gender", the second line: name="nvde", the name values ​​here must be the same.

Please modify it before running it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template