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 6048443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:27:49+00:00 2026-05-23T07:27:49+00:00

We have a multiline textarea in Internet Explorer. If we check it’s content after

  • 0

We have a multiline textarea in Internet Explorer.

If we check it’s content after the next then everything is correct (there are no extra carriage returns in textarea):

document.getElementById( 'text-area' ).value = "Hello,\nWorld!";

But if we set caret to the beginning position of the second line (in Internet Explorer, not in the code) and press tab key there is an extra carriage character (there is a string dump on keydown below):

value[0]='H'
value[1]='e'
value[2]='l'
value[3]='l'
value[4]='o'
value[5]=','
value[6]='\r'
value[7]='\n'
value[8]='W'
value[9]='o'
value[10]='r'
value[11]='l'
value[12]='d'
value[13]='!'

It’s a problem because other browsers don’t insert extra carriage return.

Do you know how to prevent this in Internet Explorer? With help of CSS or Javascript.

  • 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-23T07:27:50+00:00Added an answer on May 23, 2026 at 7:27 am

    You cannot prevent it, and you probably shouldn’t anyway. Despite the fact that IE and other browsers differ in the way that they report the value of <textarea> elements, all browsers actually do include “\r\n” for all hard line breaks in the value when the form surrounding the element is submitted. In other words, even though Firefox reports line breaks as consisting of just “\n”, it’s actually lying to you — when the form is posted, the value will have “\r” in there too.

    For some reason, jQuery normalizes the behavior across browsers by stripping out the “\r” characters, which of course is the wrong thing to do. It means that when you’re trying to count characters (like the Stackoverflow comment box), you have to take into account the fact that each single “\n” character actually represents two characters at the server. Thus you have to either strip out the “\r” on the server, or, probably better, account for it in the client-side validation code.

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

Sidebar

Related Questions

Is there a way to have multiline strings in VB.NET like Python a =
I have a MultiLine asp:Textbox (a standard html textarea for those non-asp people) that
I have this JavaScript code: var textareas = document.getElementsByTagName('textarea'); var content = textareas[0].value; var
I have a String with multiline content and want to select a multiline region,
I have a very simple asp:textbox with the multiline attribute enabled. I then accept
Is it possible (by using the stock c# TreeView) to have Multiline TreeNodes? Also,
I have a multiline text string (e.g. Stuff\nMore Stuff\nYet More Stuff), and I want
I have a multiline text box, and I'd like to display the user's current
I have a multiline textbox : <asp:TextBox ID=txtBody runat=server TextMode=MultiLine Rows=10 Width=95% /> In
I have a multiline textbox that by default, is set to ReadOnly. I would

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.