Code1: <input id="text" type="text" name="fname" value="First Name" onclick="this.value='';"/>

Hi Friends,

Code1 - this print in my text box value "First Name". onclick this value gets erased so I can type Name.
but if I go to second text box and come back to this text box to modify or add more character my earlier value gets erased due to onclick.

How to make this edit/modifiable possible without erasing text which I wrote earlier.

Example: I write ANKIT
Then I move to second text tab
Then I move to first text tab to add another letter in Ankit to make it ANKITT

but the moment I bring my cursor ANKIT itself gets erased.

Without erasing ANKIT how can I retain this as well able to add/modify another text in it.

Ankit Baphna

3 Years
Discussion Span
Last Post by patk570

Use placeholder tag, its easier...

<input id="text" type="text" name="fname" placeholder='First Name"/>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.