Placeholder text

Isn't it nice when you visit a site, and there's some soft grayed-out text in a form field giving you a hint about what you're supposed to put there? There are umpteen different jQuery plugins that have been written over the past several years to handle this because it can be a bit of a hassle.

However, I'm here with good news. HTML5 provides a placeholder attribute that can be used to create this kind of text in form fields automatically without any help from JavaScript. Of course, as with any other cutting-edge technology, browser support can be a bit lacking. We don't have the luxury of waiting years for browser support for this new feature to be universal—we have to build functioning websites now. You could continue using all ...

Get jQuery for Designers Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.