Solved

Question on textarea tag....

Posted on 1998-09-23
1
176 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

776 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