Books & Music
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
News & Politics
Religion & Spirituality
Travel & Culture
TV & Movies
Clearing a Form Field
Many uses of ASP involve forms, to process information from your users. Here's the super-easy way to have a prompt in a form field, but to have it vanish when the user clicks to type.
The most common application of this is with email addresses. You want the field to normally say something like "enter email here" so that the user knows that is what the field is for. However, that can easily result in you getting subscriptions to addresses like
enter email email@example.com
which is annoying. It's really easy to fix this. Let's say your field currently says:
<input type="text" name="email" size=30>
All you have to do is add an onClick command to it, that tells the system - when a user clicks, do something. The "something" you want to do is make this field blank. Therefore:
<input type="text" name="email" size=30 onClick="this.value=''">
That's all there is to it!
| Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map
Content copyright © 2015 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.
Website copyright © 2016 Minerva WebWorks LLC. All rights reserved.