Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
turn html into string but keep all html tags javascript

I have an array of html. I am trying to run remainderHtml.toString() but result is

[object HTMLLabelElement],[object HTMLLabelElement],[object HTMLLabelElement]

How can I run a toString command (or any other command) and create an html string Exactly like my array? I do not want to remove the tags, or extract any data, just plain want to make this array of html one long connected string...

Here is my array of html from the console.log

(4) [label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3, label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3, label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3, label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3]

When I put the above into a variable called remainderHtml and try to run a toString() on it, I get [object HTMLLabelElement],[object HTMLLabelElement],[object HTMLLabelElement]

When I click on the arrow in the console to show the html array I get this below


0: label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3
1: label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3
2: label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3
3: label.p-1.font-weight-bold.bg-primary.ml-2.text-white.rounded-capsule.shadow-none.fs--3
length: 4
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You probably want to loop through your array and get the element's outerHTML

var allHTML = "";
remainderHtml.forEach(function (elem) {
  allHTML += elem.outerHTML;
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!