to clear Textbox onclick

Hi,

I have a textbox with a value (Enter Keywords)
what I want is when the user get to the page is to see the Enter Keyword
in the textbox and when the user clickon the text box it should clear the field.

Thanks,
Here's what I have.
 
<asp:TextBox ID="TxtKeywords" onkeydown="clearInput(this);" runat="server" Text="Enter Keywords"></asp:TextBox>
 
function clearInput(obj)
{
obj.value = ""; 
}

Open in new window

lulu50Asked:
Who is Participating?
 
BTosonConnect With a Mentor Commented:
Apologies, meant this!
<asp:TextBox ID="TxtKeywords" runat="server" Text="Enter Keywords" onclick="this.value='';"></asp:TextBox>
0
 
BTosonCommented:
Hi,
Try this.  onkeydown will not work here.
<asp:TextBox on ID="TxtKeywords" runat="server" Text="Enter Keywords" onclick="this.value='';" />
0
 
lulu50Author Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.