Ok this is a short tutorial showing some ‘trick’ using the label tag in HTML. This label tag can be used to link text to an input field. When the user clicks a label, you can make it for example check a checkbox.
Example:
We set the for=”label1″ attribute for label which sets the target of the label to the input field ID which it needs to be linked with. In this case the label text is linked with the checkbox as we set the for attribute of the label equal to the ID of the checkbox. When the user clicks on the label text, the checkbox will be checked ( or unchecked if already checked ).
This is an easy, but I think quite useful trick in HTML for making your website/forms more userfriendly.
Admin.


Sat, Jan 23, 2010
HTML & CSS