How do i add a carriage return to an onclick of a textarea?
I have a textarea that acts like a comments field that users can add notes to. I want to add an onclick event to the textarea so that it adds two carriage returns, the date and a dash, so the user doesn't have to enter this. For example, if the textarea has this:
------------------------------------
07/08/08 - This is a note.
------------------------------------
When the user clicks into the text area, I want the textarea to become this:
------------------------------------
07/08/08 - This is a note.
07/22/08 -
------------------------------------
With the cursor at the end of the last dash. How can I do this?
element.value += "\r\r" + month + "/" + day + "/" + year.substring(2) + " - ";