Filed under C# , jQuery
The script below will let you use jQuery to place a simple watermark in your .net textbox. A good example would be a search box on your site where you want the word "search" in your textbox. When the user clicks into the textbox the word "search" will disappear.
The function should be easy to follow. Basically we are just checking the value of the textbox that has the class searchField on our page. If that textbox contains the word Search we are going to remove the word when the user is inside that textbox. The last part of the function is a check to ensure we don't wipe out the search term if the textbox contains a value that was entered by the user.
<asp:TextBox ID="searchField" runat="server" CssClass="searchField" Text="Search" />
And that's all there is to it!