HTML radio button implementation (gender selection) (interpretation)

Date: 2020-10-11

Question: One must be selected and only one of them

Look at the code first

<p>性别: 
	<input id="man" type="radio" checked="checked" name="sex"/>男
	<input type="radio" id="woman" name="sex">女
</p>

Insert picture description here
Among them, type="radio" represents the selection key of this origin form.
checked="checked" is selected by default in the initial state.
The
names of the two inputs are the same to ensure that the two buttons are the same "question" and only one
id can be selected. Different means these are two options

Guess you like

Origin blog.csdn.net/cyl_csdn_1/article/details/109013124