0

Question in <input> , the attribute value between radio & checkbox ⁉?

In the checkbox type they used value="1" & value="2" <input type="checkbox" name="gender" value="1" />Male <br /> <input type="checkbox" name="gender" value="2" />Female <br /> But in radio type they used a vlue="male" & value="female" <input type="radio" name="gender" value="male" />Male <br /> <input type="radio" name="gender" value="female" />Female <br />

21st Mar 2021, 3:42 PM
Tarik HAMDOUNI
Tarik HAMDOUNI - avatar
2 RĂ©ponses
+ 4
Tarik HAMDOUNI The value attribute for <input> element in HTML is used to specify the initial value of the input element. It has different meaning for different input type: The “button”, “reset” and “submit” property specifies the text on the button. The “text”, “password” and “hidden” property specifies the initial value of the input field. The “checkbox”, “radio” and “image” property specifies the value associated with the input.
21st Mar 2021, 3:57 PM
Matias
Matias - avatar
+ 3
You can use any value for "value" attribute .even you can set value of radio type 1 & 2 .
21st Mar 2021, 3:52 PM
TOLUENE
TOLUENE - avatar