Clear Field On Focus

Results 1 to 2 of 2

Thread: Clear Field On Focus

  1. #1
    Join Date
    Dec 1969

    Default Clear Field On Focus

    I was wondering how I would implement a clear field on an ASP.NET textbox control? When a user clicks tab (or clicks), and goes to the next textbox, I want it to automatically clear the text that is in there...sort of an OnFocus event. <BR><BR>Basically, is their an event or should I use client-side javascript. If javascript, how do I implement it within the textbox? <BR><BR>Any help would be appreciated! <BR><BR>-Joe

  2. #2
    Join Date
    Dec 1969

    Default RE: Clear Field On Focus

    Not sure whether this is 100% x-browser compliant:<BR><BR>&#039; In the Page_Load...<BR>MyTextBox.Attributes("onFocus") = "this.value=&#039;&#039;;"<BR><BR>&#039; In the HTML...<BR>&#060;asp:TextBox ID="MyTextBox" Runat="server" &#062;Something&#060;/asp:TextBox&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts