Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace text in text field when new text is typed.

Status
Not open for further replies.

dinoviapangea

Technical User
Apr 9, 2002
41
US
I have a text field such as below,

<input type="text" name="email" value="Enter an email" size="40" maxlength="100">

I want the "Enter an email" to disappear when a user begins to type their email address.

Thanks,
Dino
 
Code:
<input type="text" name="email" value="Enter an email" size="40" maxlength="100" [blue]onFocus="this.select()"[/blue]>

This will select the text so that if the user starts to type, it will be removed, but if they don't it will remain

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
You can do something like this:

<input type="text" name="email" value="Enter an email" size="40" maxlength="100" onClick="this.value=''">

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top