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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:50:37+00:00 2026-05-24T05:50:37+00:00

My code is something like this: function attr(el, attr, value) { el.setAttribute(attr, value); }

  • 0

My code is something like this:

function attr(el, attr, value) 
{
    el.setAttribute(attr, value);
}

    var f2=document.createElement("form");
        attr(f2, 'id', "det_"+tresult_no);
        attr(f2, 'name', "form"+tresult_no);

   var t2=document.createElement("TABLE");
    attr(t2, 'width', 80);
    attr(t2, 'border', 0);
f2.appendChild(t2);

then to see/confirm what I am doing is right, I do this:

document.getElementById('testing').value=t.innerHTML;

where “testing” is a textarea.
This works out pretty well… except with a lot of code, the textarea gets filled up and is abit hard to read.

Is there anyway to get some line breaks in the textarea after everytime I add one object to another?

Thanks!

  • 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-24T05:50:38+00:00Added an answer on May 24, 2026 at 5:50 am

    Assuming the “testing” object is an input or textarea field that displays text and newlines, how about something like this?

    document.getElementById('testing').value=t.innerHTML.replace(">", ">\n");
    

    or to just target a newline after closing tags:

    document.getElementById("result").value = html.replace(/<\/[^>]+?>/g, "$&\n"); 
    

    Note, this isn’t a perfect regex for matching closing HTML tags, but for the purposes of debugging, it should work fine.

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

Sidebar

Related Questions

I have some jQuery code something like this: $(document).ready(function() { $(img.off).click(function() { alert('on'); $(this).attr('class',
I work on code something like this ... HEADERS ... int *var; void child()
I occasionally write code something like this: // file1.cpp #define DO_THIS 1 #if DO_THIS
I often find I want to write code something like this in C#, but
The code goes something like this: protected bool IsOKToSend() { bool IsOK = true;
My code has something like this: HttpFileCollection files Instead of looping through each file
my code is something like this //css li{display:inline-block} //html #li margin and width are
I just discovered a bug where the code looked something like this: char *foo
I have a program that simulates mouse click. Code is something like this: [DllImport(user32.dll,
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody

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.