How to make input text disappear?

I have an input field in which you can type some text:


<input type="text" id="text" value="Type some text here" maxlength="35" tabindex="10">

I have some default text in this field, but I want to make the default text disappear when the user clicks on the default text or inside the input field.

How can you do this?

you could try to add onclick=“this.value=‘’;” within your input tag, try it.

A bit of javascript should do it:


<input type="text" value="Your email" onfocus="if (this.value == 'Your email') {this.value=''}" />


I originally thought about a simple line James but if the user then comes back and clicks the field again, whatever they have added gets wiped too.

Works like a charm! Thanks for the help :slight_smile: