Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3876506
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:23:22+00:00 2026-05-19T22:23:22+00:00

OK here goes – I think a <textarea></textarea> is what to use so please

  • 0

OK here goes – I think a <textarea></textarea> is what to use so please tell me otherwise. I want yo create a series of “buttons” like an RTE which inserts the appropriate code into a textarea. But note this is not a “real RTE”. What I would like is a textarea with a “menu” like an RTE but with only 2 or 3 buttons. I suspect the code for the buttons will be the same. Umm… where am I going … OK try this … on this (StackOverflow) RTE there is an “image” button. I would like to know how to create the same thing (as I said all buttons I suspect will be basically the same). The “modal” would either allow for an image src/upload or a textarea to paste say a YouTube link or Flickr link etc. (they will be separate buttons) I can create the buttons etc. and have modals open/close etc. but how can you get the code into the <textarea></textarea>

Pointers & suggestions please. – Oh I don’t need a full RTE at all so a “cut down CKeditor” etc. is total overkill The only HTML to be “uploaded/used” in the texarea is an <img src=""> an <embed> or maybe (thinking ahead) an <a href="">.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:23:22+00:00Added an answer on May 19, 2026 at 10:23 pm

    If you want to insert piece of text in the actual cursor position inside a textarea element. This will help you.

    Note: Like you know all the html inside the textarea will never be rendered.. To do this you have to use a more complex solution like the RTE engines…

    Try this:

    function insertAtCursor(myField, myValue) {
        //IE support
        if (document.selection) {
            myField.focus();
        sel = document.selection.createRange();
        sel.text = myValue;
        }
        //MOZILLA/NETSCAPE support
        else if (myField.selectionStart || myField.selectionStart == ‘0′) {
            var startPos = myField.selectionStart;
            var endPos = myField.selectionEnd;
            myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
            } else {
                myField.value += myValue;
            }
        }
    
    // calling the function:
    insertAtCursor(document.formName.fieldName, 'this');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't think this is possible but here goes... I want to add method
I feel like a fool, but here goes: public interface IHasErrorController{ ErrorController ErrorController {
This may seem like a stupid question, so here goes: Other than parsing the
Here goes: I have a view that looks like this: public interface IAddressView {
Here goes a newbie question: Create a new project in Xcode: File > New
First post, so here goes. I'm writing a script that does intelligent search and
I'm not sure if this is even possible but here goes: Currently I have
Might be subjective and/or discussion.. but here goes. I've been asked to estimate a
Im new into that asp.net thing, but here goes. I got at ImageButton, and
Ok, this may be a dumb question but here goes. I noticed something the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.