Share This!

Thursday, September 8, 2011

TextBox Watermarking in ASP.NET

This post in in answer to a recent request I got to add a gray italicized hint to the search textbox that clears when the user selects the box.

A google search or two revealed that the industry calls that a TextBox Watermark, and it looks like this:
There are 3 things you need to accomplish this.
CSS styles for the watermarked and unwatermarked boxes. 
I added these to my main stylesheet.


Javascript to change the styles...

and the HTML event wireup

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

No comments:

Post a Comment

Contact Us

Name

Email *

Message *