How do you have grayed out text in a textfield that dissapears when the user clicks on it
Posted
by
John Smith
on Stack Overflow
See other posts from Stack Overflow
or by John Smith
Published on 2010-12-26T03:54:58Z
Indexed on
2010/12/26
6:54 UTC
Read the original article
Hit count: 215
In HTML & JS, how do you make a textfield that has grayed out text telling the user what the field is for that goes away when the user clicks on the field?
For example, in firefox the search field in the top right hand side says which search engine it uses when there's nothing entered, then once you click it's an empty textfield, but if you leave it blank and remove focus from the textfield then the grayed out text is back again.
Is there a name for this behavior? Also, is it possible to do in pure css without the use of js to do the on focus / on blur events?
© Stack Overflow or respective owner