Home > Web Front-end > HTML Tutorial > The problem that the checked setting in the input attribute radio does not take effect

The problem that the checked setting in the input attribute radio does not take effect

一个新手
Release: 2017-10-23 09:39:30
Original
5492 people have browsed it

There areradio buttons used in many places on the same page and set to be selected by default. As a result, when running, it was found that the radio buttons were not selected by default

Because I copied and modified individual attributes and then used them directly, the name value was forgotten to be modified. The radio button is selected based on the name.

Before modification Similar to this:

##Since radio buttons are used in multiple places, all p using radio buttons will be When displayed, the effect is similar to the following:

The code is similar to the following code (Two sets of radio buttons have the same name attribute set. The default selection is set for each group, and only the button of the last group is selected by default):

男性:
<input type="radio" checked="checked" name="Sex" value="male" />
<br />
女性:
<input type="radio" name="Sex" value="female" />
<br/><br/>
男性:
<input type="radio" checked="checked" name="Sex" value="male" />
<br />
女性:
<input type="radio" name="Sex" value="female" />
Copy after login

The above is the detailed content of The problem that the checked setting in the input attribute radio does not take effect. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template