[thelist] hyperlinks on label tags?

ben morrison morrison.ben at gmail.com
Tue Sep 26 11:12:10 CDT 2006

On 9/26/06, Sarah Adams <mr.sanders at geekjock.ca> wrote:
> > I have a page that displays a list of categories with a checkbox + label
> > for each category and an onChange action on each checkbox.
> >
> > The labels of categories that contain sub-categories are hyperlinked.
> > When a user clicks the hyperlink to drill into the category, the
> > checkbox is also getting checked/un-checked causing undesirable results.
> >
> > Is there a way to use javascript to prevent the box from being
> > checked/unchecked when the label is/contains a hyperlink?
> >
> > Here is a sample of the current HTML ...
> >
> > <snip>
> Hi, Ryan :)
> I think this would be fairly easy to do with some DOM scripting, but I'm
> wondering - what happens if the user actually wants to check the box for
> the "parent" category?

Also, checking/unchecking by clicking the label is a default action in
most browsers (safari doesn't play nice). Generally its a good rule of
thumb to keep default actions as is to avoid confusing the user. Can
you show us an example page so we can see what you are trying to


Ben Morrison

More information about the thelist mailing list