July 1st, 7:41pm 0 comments

Nice input labels using jQuery and CSS

Nowadays it's very common to find websites "hiding" form labels in favor of input's default text. Even tough it's a cleaver idea, there is a better way to accomplish the same result without compromising accessibility.

First step is to create the form. I usually have all my forms inside a list:

UPDATE: It's necessary to turn off the "autocomplete" so the inputs don't get messed up.

Markup

Don't forget the "for" attribute, the script will rely on it. Go ahead and add the following CSS:

CSS

Read more …

Posted