Put the script down!!
-
Here's a little something I stumbled on today. I was building a web form and since I can never remember the html for using a checkbox by clicking on the text next to it I simply googled "checkbox label". This is the seventh result. It works, but maybe there's an easier way?
The scary part is that it's on the first page of the results. God knows how many script kiddies out there are educating a whole new generation of script kiddies by pointing them to this page.
-
I don't do websites, so tell me, is there a better way?
-
@Daid said:
I don't do websites, so tell me, is there a better way?
<label for="foo">Check your option:</label>
<input type="checkbox" id="foo" />
-
@dhromed said:
Hey thanks. learn something every day.@Daid said:
I don't do websites, so tell me, is there a better way?
<label for="foo">Check your option:</label>
<input type="checkbox" id="foo" />
-
doesn't
<label>Check your option: <input type="checkbox"/></label>
work just as well?
-
@vt_mruhlin said:
Not on IE last time I checked. But that would be IE6.doesn't
<label>Check your option: <input type="checkbox"/></label>
work just as well?
-
@vt_mruhlin said:
doesn't
<label>Check your option: <input type="checkbox"/></label>
work just as well?
Also, that doesn't work if you separate out your label and input element into two separate elements (such as two different table cells).
-
@vt_mruhlin said:
It's supposed to, according to the spec:doesn't
<label>Check your option: <input type="checkbox"/></label>
work just as well?
"To associate a label with another control implicitly, the control element must be within the contents of the <samp class="einst">LABEL</samp> element. In this case, the <samp class="einst">LABEL</samp> may only contain one control element. The label itself may be positioned before or after the associated control."
-
@DOA said:
I simply googled "checkbox label". This is the seventh result. It works, but maybe there's an easier way?
And, partly thanks to your valiant efforts, it is now the fifth result.