Wednesday, March 5, 2008

Labelless

HTML forms have two major components, input and label. In most cases, using the label tag is not essential. There are, however, two cases where the user will be very grateful to you for not forgetting this seemingly unimportant tag, checkboxes and radio buttons. When used with a for="input_id" parameter, where input_id is the id you assigned to your input field, the user will be able to interact with the input by click on the label. The input tag can be placed inside or outside the label tag as long as the id and for parameters are the same. I find it very annoying when a developer failed to enclose the field label for a checkbox or a radio button inside a label tag, leaving me with the only option of clicking on the relatively small checkbox/radio button.

I hope those of you who burden us with this inconvenience will happen to see this blog entry and correct this bad habit of yours. Good practice for everyone is to always always use label whether you "need" to or not.

No comments:

Post a Comment