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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:45:10+00:00 2026-06-17T05:45:10+00:00

If I have content preloaded in textarea then I have new lines converted to

  • 0

If I have content preloaded in textarea then I have new lines converted to “br” tags.

But if I try to set content dynamically (not pasting) to tinymce textarea by using its setContent function new lines are missing.

I use v.3.4.7, tried v.3.5.6 (the latest by far) and it removes new lines even on page loading.

<script type="text/javascript">
    tinyMCE.init({
        mode: "textareas",
        editor_selector: "EmailBody",
        theme: "advanced",
        language: "en",
        charLimit: 10,
        plugins: "table,advhr,advlink,insertdatetime,preview,print,contextmenu,paste,directionality",
        theme_advanced_buttons1_add: "fontselect,fontsizeselect",
        theme_advanced_buttons2_add: "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
        theme_advanced_buttons2_add_before: "pastetext,pasteword,separator",
        theme_advanced_buttons3_add_before: "tablecontrols,separator",
        theme_advanced_buttons3_add: "advhr,separator,ltr,rtl,separator",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        plugi2n_insertdate_dateFormat: "%Y-%m-%d",
        plugi2n_insertdate_timeFormat: "%H:%M:%S",
        paste_use_dialog: false,
        theme_advanced_resizing: false,
        theme_advanced_resize_horizontal: true,
        paste_auto_cleanup_on_paste: true,
        paste_convert_headers_to_strong: false,
        paste_remove_spans: true,
        width: "100%",
        paste_remove_styles: true,
        valid_elements: "a[href|target=_blank],strong/b,div[align],p,br,i,u",
        content_css: "/css/tinymce_bigger_default_font.css",
        forced_root_block: false,
        force_br_newlines: true,
        force_p_newlines: false,
        apply_source_formatting: false,
        remove_linebreaks: false,
        convert_newlines_to_brs: true
    });
</script>

function Click()
{
    var text = document.getElementById("preText").innerText;
    tinyMCE.activeEditor.setContent(text);
}

<pre id="preText">Text

Text
</pre>

The result must be as follows:

Text

Text

But instead I get:

TextText
  • 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-17T05:45:12+00:00Added an answer on June 17, 2026 at 5:45 am

    How to replace new lines to break lines on initial content set:

    convert_newlines_to_brs and remove_linebreaks parameters have been removed from tinymce (check your tinymce source code).

    To restore convert_newlines_to_brs functionality use this code (it was taken from previous version of tinymce):

    tinyMCE.init({
        setup : function(ed) {
            ed.onBeforeSetContent.add(function(ed, o) {
                if (o.initial) {
                    o.content = o.content.replace(/\r?\n/g, '<br />');
                }
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have content that is being dynamically generated. How to I listen to a
What would be the best way to have preloaded data in html and then
I have a tableview which is being reloaded as new content is added, using
I have content on my page in boxes. They are displayed like this. Box1
I have content loaded into a hidden iframe on a page and I'm wanting
I have content on a webpage which is both sent from the server at
I have content management system application that uses a polymorphic tree table as the
can we have content text directly in <div>text content</div> or it should be like
I have a content div that surrounds all my content, a navigation div and
I have a content page(Say.. invoice.aspx) in asp.net application with master pages. The content

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.