If I have this markup:
<label>Email Address:</label>
<input class="validation-failed" type="text"></input>
How do I select the label, only if the input has the class .validation-failed
?
If I have this markup:
<label>Email Address:</label>
<input class="validation-failed" type="text"></input>
How do I select the label, only if the input has the class .validation-failed
?
As mentioned in comments there is no pure css solution,
There is a jQuery solution using the .prev() method, ref: https://api.jquery.com/prev/