I’m using jQuery validation.
When for is now valid, validator is creating those:
<label class="error" for="username" generated="true">
As all label has got the same class=error can I select with CSS this exact one based on ‘for’?
I know how to sort this out with jQuery – but always looking for cleanest, purest way.
Any suggestion much appreciated.
Pete
Using the (CSS2) attribute selector:
This will work in IE8+ and all modern browsers.
IE7’s attribute selector is buggy: as explained here, to match
foryou must usehtmlFor.So, if you need IE7 support, use this: