View Full Version : css selector for the label associated with a particular checkbox?

8 May 2010, 5:35 AM
Checkbox and their labels are being rendered by Ext Designer not with the nested label syntax but with the "for={id}" syntax, like this:

<div id="ext-gen###" ... >
<input id = "foo" ... >
<label id = "ext-gen###" ... for="foo">foo label</label>

The DIV wrapper and label receive autogenerated ids. The checkbox input field has the id that I have assigned.
What is the CSS selector for the label associated with the checkbox whose id = "foo"? I don't want to reference the label by class x-form-cb-label.

8 May 2010, 7:56 PM
CSS3 Solution, which is not cross-browser compatible:

input#foo + label

Consider using an Ext.Element to get to the label programmatically, and perhaps applying your own CSS class or styles to the label element that way:


See the documentation on Ext.Element: