April 19, 2012
Text box with default text
Question by anna
I have a text box with a default text. I am using javascript to dissapear it when the user clicks in this, but i want to make it work without javascript. Is there any way to do that in html or php? Thank you!
Answer by zellio
It can be done in flat HTML5 using the placeholder
attribute of the <input>
tag
<input type="text" placeholder="Default Text" />
Answer by Starx
In HTML5, there has been the introduction of new attribute called placeholder
You can use it like this
<input type="text" placeholder="text to show and hide" />