View Full Version : Make Default Text Disappear On Click?

11-03-2011, 12:49 AM
I have a textarea, and it has the default text set to "Write your post in here..."

When a user clicks the textarea, I need that default text to disappear, so the user doesn't have to hit backspace.

If you look at the top of CodingForums.com, you can the Google custom search bar, if you click inside the box, "Google Custom Search" goes away. That's what I need my textarea to do. How can I do this?

11-03-2011, 03:17 PM
It is not an attribute to the textarea tag. It must be done via javascript.

<textarea cols="25" rows="5" onclick="document.getElementById('area').innerHTML='';" id="area" >Write your post in here...</textarea>

11-03-2011, 07:17 PM
Thank you!