0

For what purpose the keyword" for" is used in <label> in forms??

15th Aug 2017, 5:32 AM
J.SAIKIRAN
J.SAIKIRAN  - avatar
4 Respostas
0
in the forms it's used to bind label with a specific input for example. In fact you must use the same value for id in the input and for in the label. for example: <label for="name">Your name</label> <input id="name">
15th Aug 2017, 5:46 AM
Michele Virgilio
Michele Virgilio - avatar
0
what happens if we remove" for" ?
15th Aug 2017, 5:48 AM
J.SAIKIRAN
J.SAIKIRAN  - avatar
0
nothing will happens :) . I try to explain better. If you use for to bind label to a input, like radio or checkbox for example, then you can click or touch the input or the label for the same result. if you don't use for then you can't click on label to select his binded input
15th Aug 2017, 6:12 AM
Michele Virgilio
Michele Virgilio - avatar
0
look to this example ... i've 2 radio control... the 1st is for male, the second for female. you can select control by clicking on the radio button or clicking his label. try to write for="female" in male label and viceversa https://code.sololearn.com/Wcs33x3l6IFx/?ref=app
15th Aug 2017, 6:20 AM
Michele Virgilio
Michele Virgilio - avatar