header
 
     
 
pixel
pixel pixel

Clear text box when clicking on it

If you have a text box on your webpage (eg - a search form) with text in it (eg - "Search..."), it adds an extra level of convenience for your user if the text box clears when the user clicks inside the box. This is achieved with some simple javascript:
<input type="text" name="Search" value="Search..." onclick="this.value='';">
The crucial part is onclick="this.value='';" - whenever the text box is clicked on, it sets the text box's value to empty.

Unhelpful Helpful Rating 3.5 (score out of 5, no. of ratings: 211)
Comments
Comment by paul michael margallo on 2010-09-01
good

Comment by richard on 2011-08-22
I like this quick tip, very neat!

Comment by Eric Gillette on 2011-10-26
Thanks for that! Nice one!

Comment by James K on 2011-10-04
nice compact code that u can use directly on the element when required. Thanks mate

Comment by Jase on 2011-08-18
I cnonat tell a lie, that really helped.

Comment by discount Michael Jordan Shoes on 2010-09-17
Air Jordan Shoes are always so attractive, good quality can ensure the wearer's feet, not only that, the Michael Jordan Shoes has become a fashion, many young people are very fanatical Air Jordan. High price so many people can realize their dreams. Well now, our products directly from third-party products, so we can provide cheap Jordan Basketball Shoes and New Jordan Shoes, high quality, excellent service, come on, give yourself a choice. We offerAir Jordan 1, Air Jordan 2, Air Jordan 3,Air Jordan 4, Air Jordan 5, Air Jordan 6, Air Jordan 7, Air Jordan 8, Air Jordan 9, Air Jordan 10, Air Jordan 11 and so on!

Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image