I want to use a textbox that shows a text.
For example : Someone@example.com. When the user clicks on it, the textbox is cleared and ready for the user to type.
If you are working on newer browsers then you can use placeholder
property which is new in HTML 5
<asp:TextBox ID="textBox1" runat="server" placeholder="Someone@exmaple.com"></asp:TextBox>
otherwise you can also use onfocus
and onblur
event to do this as described here
you can use this, is so easy
<input class="status" type="text" size="5" placeholder="started" />
placeholder show you the text you want
hope it helps you!
You can do the following:
Hope that helps
You can use like this
<TextBox ID="txtone" runat="server" tooltip="Enter comments"
onblur="if(this.value=='') this.value='Someone@exmaple.com';"
onfocus="if(this.value == 'Someone@exmaple.com') this.value='';"
Text="Someone@exmaple.com"></TextBox>
Try this for a server control:
<asp:TextBox ID="textBox1" runat="server" placeholder="Someone@exmaple.com"></asp:TextBox>
For an HTML control:
<input Type="Text" ID="textBox1" placeholder="Someone@exmaple.com" />
You can use this ajax if you want a cross browser compatible version.
<ajaxToolkit:TextBoxWatermarkExtender ID="EmailClear" runat="server" TargetControlID="EmailAddress" WatermarkText="Someone@example.com" />
You just have to add this under each field.