Reputation: 51
I want to use a textbox that shows a text.
For example : [email protected]. When the user clicks on it, the textbox is cleared and ready for the user to type.
Upvotes: 4
Views: 21084
Reputation: 1045
You can use this ajax if you want a cross browser compatible version.
<ajaxToolkit:TextBoxWatermarkExtender ID="EmailClear" runat="server" TargetControlID="EmailAddress" WatermarkText="[email protected]" />
You just have to add this under each field.
Upvotes: 0
Reputation: 325
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!
Upvotes: 2
Reputation: 1697
Try this for a server control:
<asp:TextBox ID="textBox1" runat="server" placeholder="[email protected]"></asp:TextBox>
For an HTML control:
<input Type="Text" ID="textBox1" placeholder="[email protected]" />
Upvotes: 0
Reputation: 17614
You can use like this
<TextBox ID="txtone" runat="server" tooltip="Enter comments"
onblur="if(this.value=='') this.value='[email protected]';"
onfocus="if(this.value == '[email protected]') this.value='';"
Text="[email protected]"></TextBox>
Upvotes: 0
Reputation: 43
You can do the following:
Hope that helps
Upvotes: 0
Reputation: 40970
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="[email protected]"></asp:TextBox>
otherwise you can also use onfocus
and onblur
event to do this as described here
Upvotes: 6