Solved

Question on textarea tag....

Posted on 1998-09-23
1
173 Views
Last Modified: 2010-04-09
Let me explain a little.

I'm trying to create an online application in which I'll be doing some text editing in a textarea tag.  Well, I want to add some tools (buttons) that when clicked on, it will insert predefined text at the cursor position.

I know that I could take the contents and append to it, but that will only put the predefined text at the end of the current text.  I want to be able to insert it anywhere inside the current text, e.g.  I have a textarea that has the content, "There will be no weekly meeting on 9/24/98."  I want to have 5 buttons, each labeled with the day of the week that I could use to insert say, Thursday in between the "on" and the "9/24/98".

If you have ANY information on this, PLEASE let me know.  Thanks all!

---LSILes
les@livingscriptures.com
0
Comment
Question by:LSILes
1 Comment
 
LVL 8

Accepted Solution

by:
jbirk earned 200 total points
ID: 1838056
Well as you may have suspected, this can't be done as you have suggested.  There is no way to know where the cursor is in the textarea, and then as was stated on the other copy of this question (one of them should be deleted), is that once you click on a button the focus is changed and you no longer even have a cursor.  So you can't do anything with the cursor.

If you knew beforehand something about the contents of this text area you could read it in and determine where to insert the new data, and then output the change.

Other than that the best suggestion I have is to output the desired produced text from clicking on a button into a text box, and have the user copy and paste it into where they want it to go.

I'm afraid that's probably the best you can do.
Sorry,
Josh
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Jump to a specific point on a responsive page 5 28
Glyph icons in Bootstrap 3 4 38
Centering a nested div 16 58
.php tree directory? 5 56
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now