anna
anna

Reputation: 755

Text box with default text

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!

Upvotes: 0

Views: 1653

Answers (3)

ketan italiya
ketan italiya

Reputation: 296

it is simple you can use html5 control also.there like.

<input  type="text" name="txtFirstName" id="txtFirstName"
placeholder="enter first name" />

Upvotes: 0

Starx
Starx

Reputation: 78971

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" />

Upvotes: 0

zellio
zellio

Reputation: 32484

It can be done in flat HTML5 using the placeholder attribute of the <input> tag

<input type="text" placeholder="Default Text" />

Upvotes: 3

Related Questions