Modify Text Area Input Field

Currently I have a text area on a website and have some default text in the textarea. I found some javascript that lets me erase this text from the field when the user clicks inside the field.

Sadly this happens any time the user clicks in the field. So if they add text themselves and click in the box it will erase what they typed.

I only want it to remove the text when the user clicks in there the first time. If the user clicks away /without typing anything in the box/ I want my ‘default text’ to be put back into the box. But if they have put text in the box and click away, the text should stay. . .as well as if they click inside the box.

I need this feature integrated into a current website. This website uses the Smarty Template Engine, so you’ll probably need to be familiar with this in order to integrate this feature into the website.

Leave a Reply

Your email address will not be published. Required fields are marked *