Labels in HTML forms

26 January 2004   2 comments   Web development

Mind That Age!

This blog post is 14 years old! Most likely, its content is outdated. Especially if it's technical.

Simon Willison has written a nice article about Simple tricks for more usable forms and from it I learned about how <label> tags work. They have been part of HTML since 1998 so today most browsers should support them; and if not, it's not a show-stopper. What they do is that they help to associate a text with an input field. For example, here, mouseclick the word "Name" and "Agree?" below.


Nothing happens! Instead, with <label> tags, notice the difference when you mouseclick the words "Name" and "Agree?"

For code for the latter example is:

<label for="name2"><b>Name</b></label>  
<input name="var21" id="name2"><br>
<label for="agree2">Agree?</label>
<input type="checkbox" name="var22" id="agree2">


does not work
whats the point?

Your email will never ever be published

Related posts

Robots.txt Validator 24 January 2004
Dabbrev in Jed 26 January 2004
Related by Keyword:
Automatically strip whitespace in Django forms 12 October 2009
Button tag in bloody Internet Explorer 09 August 2005
Related by Text:
Be very careful with your add_header in Nginx! You might make your site insecure 11 February 2018
jQuery and Highslide JS 08 January 2008
I'm back! has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
I'm Prolog 01 May 2007