0
form
why we can't use text for the value attribute of checkbox instead of numbers (value=1)?
2 Answers
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!
0
Ok I'll check it. Thank you very much.