APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

"label for" checkboxes and radio buttons

© July 2004 Tony Lawrence
Sat Jul 17 17:10:54 2004

DevNiall made me aware of an HTML form feature I didn't know about. These two checkboxes are very similar:

Just a check box

But there is a difference: on the bottom one, you can click on either the text or the checkbox itself. On the top one, you have to click on the box.

The code difference is just the addition of an id and a "label for" tag:

<input type="checkbox" name="acbox" value="Just a check box">Just a check box

<input type="checkbox" id="idbox" name="cboxwithlabel" value="Another check box"><label for="idbox">Another checkbox</label>

DevNiall explained:

Now instead of a 16x16 capture (just the checkbox) you have the
checkbox *and* the label itself available for capture, just like any
normal UI.

By "capture" I mean that the label is capable of capturing, responding
to, and bubbling events like onclick etc. The UI term for actually
clicking on the thing is "acquisition", as in "the target is
easier to acquire because you can click on the label or the checkbox".

Thanks, Niall!

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> 'label for' checkboxes and radio buttons


Inexpensive and informative Apple related e-books:

Photos: A Take Control Crash Course

Take Control of Numbers

Take Control of the Mac Command Line with Terminal, Second Edition

El Capitan: A Take Control Crash Course

Take Control of High Sierra

More Articles by © Tony Lawrence

Thu Oct 8 16:23:20 2009: 7152   ArmandoBorge

Thanks... Good Information and very helpful...!!!


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Today’s computers are not even close to a 4-year-old human in their ability to see, talk, move, or use common sense. One reason, of course, is sheer computing power. It has been estimated that the information processing capacity of even the most powerful supercomputer is equal to the nervous system of a snail—a tiny fraction of the power available to the supercomputer inside [our] skull. (Steven Pinker)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode