Form Labels

You can make a checkbox or radio button work like they work in Windows, and allow the user to click on the text after the control to activate the control, instead of forcing them to click on that little tiny box or radio button.

Put "label" tags around the control, and make sure the for attribute matches the id attribute of the control, and make the id unique. It's a neat little feature that can make a page a little more friendly!


<label for=box1>
<input type=checkbox name=dz id=box1>Label text

<label for=radio1>
<input type=radio name=line9 id=radio1>Label text

<label for=radio2>
<input type=radio name=line9 id=radio2>Label text


Test it here:

html checkboxes forms radiobuttons radio button form labels label tag

Back To Top
© 1998 - 2024
Version 7.21 | Advertise on this site