Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
please can anybody help me that how to write a light text on textbox and when user click on the textbox it text hide
Posted
Comments
Sergey Alexandrovich Kryukov 29-Sep-15 14:47pm    
Not clear. If you hide element, its color does not matter. Are you talking about text selection of changing colors?
—SA
Richard Deeming 29-Sep-15 15:15pm    
I suspect the two people who have posted solutions have worked out what he means. :)
Sergey Alexandrovich Kryukov 29-Sep-15 15:46pm    
Hopefully... Thank you, Richard.
—SA

You have a property called "placeholder" for input control. Try to set value to it. The light text will disappear when user enters any text in the textbox and not by clicking on it.

Check this: http://jsfiddle.net/LgfLqa0a/[^]
 
Share this answer
 
Try below code:
ASP.NET
<asp:textbox ID="txtName" runat="server" placeholder="Enter Name"></asp:textbox>

Here it uses placeholder property of HTML5. Once user will focus on textbox "Enter Name" will hide.

If you want to implement it manually through javascript then please go through below link:
http://www.c-sharpcorner.com/Blogs/13860/how-to-set-watermark-in-Asp-Net-textbox.aspx[^]
 
Share this answer
 
v2
Comments
Member 11963532 29-Sep-15 15:36pm    
thmx lott bro its really nice and simple and due to this we dont need to write java script functions and other its simply works

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900