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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:48:54+00:00 2026-06-11T10:48:54+00:00

I am experimenting with a script from another stackoverflow post. I have a textarea

  • 0

I am experimenting with a script from another stackoverflow post. I have a textarea element that someone can enters text. By double clicking on it, it converts to div and it keeps line breaks. When you dblclick on the div to turn back to textarea, the <br />s are left as are.

You can see the jsfiddle right here http://jsfiddle.net/QUFZJ/

How can I get back the text without the br’s but keeping the line breaks ?

  • 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-06-11T10:48:55+00:00Added an answer on June 11, 2026 at 10:48 am

    You should use

    boxText = $(this).html().replace(/<br\s?\/?>/g,"\n");
    

    instead of

    $(this).val().replace(/<br\s?\/?>/g,"\n");
    

    You need to assign new value to boxText because You set text area value like this

    $(this).replaceWith( '<textarea form="HTML" class="BoxText">' + boxText + '</textarea>' );
    

    jsFiddle example

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

Sidebar

Related Questions

I have a script that loads a massive directory listing and just (in it's
I have developed a recursive FTP-download script, in PHP5, that allows you to select
I'm experimenting with CS-Script and my problem is that each time I run a
I'm currently experimenting with build script, and since I have an ASP.net Web Part
I'm experimenting with YUI 3 Rich Text Editor and came across an incident that
I have a small script that launches and, every half hour, feeds a command
I'm experimenting on this code that I got from the net (I'm trying to
I am experimenting with changing some stylesheets from javascript I have come across a
When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with
I am experimenting with Dart. I have created an on click event like so:

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.