Talk:Checkbox

Jump to: navigation, search

Checkbox label

why AFTER (which is bolded in the text): "Create a checkbox with an id attribute. Add a <label for="id_of_checkbox"> element after the checkbox. As the text content of the label element, write the result of checking the box: "

I seem to recall having placed a label so it includes both the checkbox and the text belonging to it. I have sometimes used that to put in a tooltip with a title="when you put a check here, life will be wonderful ;-)" in the label tag and it would be good if that came up while hoovering over the checkbox itself. Isn't it also possible to make the checkbox "mouseclickable" even on the text which belongs to the checkbox? Jeff Forssell 09:24, 4 August 2009 (UTC)

Hi Jeff,
Very good. I only learned last summer that having the checkbox inside the label also works. The point is mainly that the content of the label, the text describing the checkbox, needs to be on the right of the checkbox (in left-to-right languages). The label is always mouseclickable (to activate the checkbox) if it is correctly associated with the checkbox in question. Will have to confirm in the forums if checkboxes should always be inside label elements. --Olli Savolainen 10:11, 4 August 2009 (UTC)