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

  • SEARCH
  • Home
  • 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 7440991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:56:19+00:00 2026-05-29T10:56:19+00:00

I am selecting a text on textarea and replacing it with newtext shan..The problem

  • 0

I am selecting a text on textarea and replacing it with newtext “shan”..The problem when I click on the submit button still the old text is submitted instead of new text..

But this problem doesn’t come when I press spacebar on keyboard and then press Submit button..

I can see the replaced text in “TextArea” but when I submit it the only the old text gets submitted..

     var replacement text="shan";
    if (window.getSelection) {
       sel = window.getSelection();

    if (sel.rangeCount) {
        range = sel.getRangeAt(0);
        var e1=range.startContainer;
        var e2=e1.getElementsByTagName('textarea');
        e2[0].value=replacementText;
            e1.focus();
        }
     }    
  • 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-29T10:56:20+00:00Added an answer on May 29, 2026 at 10:56 am

    Syntax Error?

    var replacementText = "shan";
    if (window.getSelection) {
        sel = window.getSelection();
    
        if (sel.rangeCount) {
            range = sel.getRangeAt(0);
            var e1 = range.startContainer;
            var e2 = e1.getElementsByTagName('textarea');
            e2[0].value=replacementText;
            e1.focus();
        }
    }
    

    Other things to look at or update your question with…

    How are you submitting the form?

    Do you have the textarea named appropriately so that it will get sent back to the server properly? Are you getting the value out properly via javascript(if thats how you are posting back)?

    Have you checked the post info with Fiddler or Firebug or Chrome to see what the request actually looks like?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a better way to do this jQuery selection: $(p.DynFieldWrapper :input:not(:text):not(textarea)).focus(HideDynamicFormError).click(HideDynamicFormError); $(p.DynFieldWrapper :text,p.DynFieldWrapper
I need to prevent user from selecting text (select all or select a portion
Selecting a large amount of text that extends over many screens in an IDE
Problem: How can I tell if a selection of text in the CRichEditCtrl has
My goal: each time a user selects text, and clicks a button, that text
Flex's text-editing controls (mx:TextField, mx:TextArea) offer functions for doing stuff with the selected text
I would like to perform something with all my text areas, however selecting all
I want to replace selected text(or insert new text after cursor position if nothing
How can I insert text before and after the selection in a textarea with
How would you get the currently selected text within a textarea (and modify it)?

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.