How do I make an HTML text box show a hint when empty?

Posted by Michael L Perry on Stack Overflow See other posts from Stack Overflow or by Michael L Perry
Published on 2008-09-20T13:55:10Z Indexed on 2010/04/17 12:33 UTC
Read the original article Hit count: 352

Filed under:
|

I want the search box on my web page to display the word "Search" in gray italics. When the box receives focus, it should look just like an empty text box. If there is already text in it, it should display the text normally (black, non-italics). This will help me avoid clutter by removing the label.

BTW, this is an on-page AJAX search, so it has no button.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html