Always use the for attribute on labels
In the same vein as the last post: For a while there, I thought I could take a shortcut by saying:
<label><input type="checkbox" name="foo" value="1" /> The label</label>
Instead of the more cumbersome:
<label for="mycheckbox"><input type="checkbox" name="foo" id="mycheckbox" value="1" /> The label</label>
That way I don’t have to worry about setting the ID for the checkbox, making sure it’s unique, and all that.
It works fine in Firefox, and Safari ignores it, just like it ignores any old label tag. But Internet Explorer, of course, had to not work. So forget about that, and just use the for
and id
attributes like you always did. Bah.
About Calvin Correli
I've spent the last 17 years learning, growing, healing, and discovering who I truly am, so that I'm now living every day aligned with my life's purpose.
0 comments
Leave a comment