0

form

why we can't use text for the value attribute of checkbox instead of numbers (value=1)?

30th Apr 2020, 5:17 PM
Dilini Jayasundara
Dilini Jayasundara - avatar
2 Antworten
0
Dilini Jayasundara This is quite a nice question. You can use both number and text for the 'value' attribute of checkbox input. But the thing is it will not render in the screen. This is because checkboxes are rendered in the screen independently. So you just see a rounded box in the screen. However you can use the label tag to do the same! <input type="checkbox" id="cbox" value="Can be anything"> <label for="cbox">Check me</label> You can still get the value from the checkbox by using javascript!
1st May 2020, 6:24 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
0
Ok I'll check it. Thank you very much.
1st May 2020, 6:44 AM
Dilini Jayasundara
Dilini Jayasundara - avatar