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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:18:52+00:00 2026-05-23T12:18:52+00:00

If I get an element that has a <BR \> inside, and get it’s

  • 0

If I get an element that has a <BR \> inside, and get it’s text with the innerText property, I’m seeing that the line break is two characters: 13 and 10. What determines this? Is it the browser or the web page’s encoding?

I want to either make sure line breaks are always going to be this two characters (as long as it’s part of the static content of the web page and not dynamically created content) or modify my text processing algorithm to handle both possibilities.

This is something I’ll be using to split text into lines with the split method. I’m not sure if I should use split("\r\n") or some more complicated code.

  • 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-23T12:18:53+00:00Added an answer on May 23, 2026 at 12:18 pm

    It depends on your editor and/or OS. Windows uses \r(13)\n(10). Unix systems use only \n. Old macs used \r.
    You could just replace all \r\n by \n and than split on \n. So

    //"test\r\nnewline".replace('\r\n','\n').split('\n')//only replaces the first newline
    "test\r\nnewline".replace(/\r\n/g, '\n').split('\n')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to get the ID of the element that fires an
I have two types of links that are event-bound. If the clicked-on link has
I have a Node class that has an 'element' slot which contains a list
How can I get the height of an element which has got a parent
I am trying to write an MVC webpage that has two drop down lists.
How do I get an element or element list by it's tag name. Take
I can get the element like this $(#txtEmail) but I'm not sure how to
I am trying to get an element using JQuery's selector, but it does not
Prototype library uses $('element-id') or $F('element-id') to get the element or value of a
I need to get the td element of a table. I do not have

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.