Clearing contents of a input box when a user clicks in it
One of the most annoying things I find in a website is a search bar that says “Search Here…” or something of those likes, because when you click in that box you have to manually erase the text, it is not a big thing but it is very easy to solve. All you need to do is copy and paste this code into the <input /> tag.
Code Snippet:
onfocus="this.value=''"
Full Code:
<input type="text" name="test" value="search" onfocus="this.value=''" />
Example:
Now this won’t work if the user has Javascript turned off, but that is their fault not yours. This only works on <input type=”text” />
Look for my article on the basics of CSS soon.
Visit this awesome link!
Post a Comment »
Comment Guidelines