Reputation: 137
How can I select the following (which is created by jquery validate)?
<label class="error" for="location[]">...</label>
The CSS Selector
.error[for=location[]]
does not work neither
.error[for=location]
Upvotes: 1
Views: 500
Reputation: 3101
You need to put attribute value in quotes in selector
.error[for="location[]"]
{
color:red;
}
JSFiddle: http://jsfiddle.net/TQ2nN/
Upvotes: 3
Reputation: 99484
You can wrap the attribute value by quotes "
as:
.error[for="location[]"]
Or use a leading back-slash \
to escape the brackets as:
.error[for=location\[\]]
However, you can also use the attribute selector as for^=location
.
Upvotes: 2