Form Input text disappear on click and reappear if nothing has been entered

Hi there,

I believe this would be a javascript piece of code.

Basically i need help with input fields that when clicked the text (value) disappears but if the user has not entered anything in it would revert back to what was originally there.

I have managed to get the value inside to disappear once clicked without the use of javascript but would love someone to point me in the right direction of how to revert the original value back if nothing was entered in if the user did click inside as the field continues to be blank which i know is minimal but it something small that is annoying me :slight_smile:

Heres what i have got at the moment…

			<input onfocus="if(this.value == 'Name'){this.value = '';}" type="text" id="name" value="Name" />		
			<input onfocus="if(this.value == 'Email'){this.value = '';}" type="text" id="email" value="Email">
			<textarea name="message" onfocus="if(this.value == 'Message'){this.value = '';}" class="textarea">Message</textarea>
			<button type="submit" class="button">Submit</button>

You need onblur for that


<input onfocus="if(this.value == 'Name'){this.value = '';}" type="text" [B]onblur="if(this.value == ''){this.value='Name';}"[/B] id="name" value="Name" />		

I think you can figure the other fields out for yourself :slight_smile:

That simple ScallioXTX, your a legend and i feel like a idiot lol

much appreciated for your quick reply :smiley: