Khawer Zeshan
Khawer Zeshan

Reputation: 9646

How to select "label for=list[]" in CSS?

I have an array of check boxes and jquery validate plugin applies the label with class error like this,

<label for="list[]" class="error">This field is required.</label>

I have checked this answer but when i changed it to label[for=list[]] it didn't work. How can i select it using css?

Here is the FIDDLE

Upvotes: 3

Views: 289

Answers (1)

Josh Crozier
Josh Crozier

Reputation: 241238

Use quotes around the value. In this case "list[]".

EXAMPLE HERE

[for="list[]"]{
    color:red;
}

For more information, check out the documentation on attribute selectors.

Upvotes: 6

Related Questions