1

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] 

2 Answers 2

3

You need to put attribute value in quotes in selector

.error[for="location[]"] { color:red; } 

JSFiddle: http://jsfiddle.net/TQ2nN/

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.