I use jQuery Validate plugin to highlight errors. It replaces color of the text with red, which is OK for all elements except one – .help-block, it should remain blue.
Here is the code without error:
<div class="control-group">
<label class="control-label" for="place-of-birth">Place of birth</label>
<div class="controls">
<p class="help-block">Please input place of birth below, 2-80 symbols</p>
<input type="text" class="input-xlarge" id="place-of-birth" name="place-of-birth" minlength="2" maxlength="80" autocomplete="off">
</div>
</div>
And here is with the error message:
<div class="control-group error"> <!-- STYLE IS CHANGED HERE -->
<label class="control-label" for="place-of-birth">Place of birth</label>
<div class="controls">
<p class="help-block">Please input place of birth below, 2-80 symbols</p>
<input type="text" class="input-xlarge" id="place-of-birth" name="place-of-birth" minlength="2" maxlength="80" autocomplete="off">
<div class="help-block" generated="true" for="place-of-birth">Please enter at least 2 characters.</div> <!-- THIS LINE IS ADDED -->
</div>
</div>
I’ve tried to override that with the following CSS:
.control-group .error .help-block { color: blue; }
but it didn’t help. Demo.
What is wrong here?
Change it like this:
If you have two classes on one element there cannot be space between selectors. If there is a space it means that this class belongs to child tag.