I’ve poured over dozens of sites about forms and in particular I was reading about form field hints. Obviously this is when a field is in focus regardless of whether its an input, select, textarea, etc it shows a hint, usually to the right of the field.
I’ve stuck with using the adjacent sibling selector, for example:
input:focus + span {declarations}
Of course the span tag will contain a hint and the HTML code is something like this:
<label for="email">Email:</label>
<input type="text" size="50" maxlength="50" name="emailaddress" id="email" />
<span>A maximum of 50 characters are allowed. Email format should be email@address</span>
I know about accessibility saying that the span tag should be in the label tag, and I also know that this works in IE8, perhaps IE7, Firefox, Safari, Opera, etc and as for IE6 users they simply have to live with server side script feedback for errors. Personally I love using CSS for the form field hints because its so simple and clean
What I want to know is whether anyone has used this for their own forms using just CSS or is the JavaScript option better overall?