troubleshooting Question

How do i add a carriage return to an onclick of a textarea?

Avatar of bemara57
bemara57 asked on
JavaScript
2 Comments1 Solution360 ViewsLast Modified:
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?
ASKER CERTIFIED SOLUTION
MMDeveloper

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros