0

I am doing a project and I need to put generated data in a table. However, the data that is generated is generated in a <div>data</div> format. I am unable to change how this data is given to me so I need to work with it. For formatting sake, I can't just keep it in the div.

How can I convert

<div>data</div>

into

<tr><td>data</td></tr>
  • 1
    I mean, you could just `.slice(5,-6)` the string and concatenate the tags you want around it... – Niet the Dark Absol Oct 21 '21 at 19:31
  • 2
    Given the goal why are you not also wrapping those elements with a ``? Would it be acceptable to wrap the `
    ` within the `
    `? There are a few ways of going about this with JavaScript (or any of its libraries), but what structure do you initially receive? Why is the data generated in a structure that you don't want to use, can that be changed?
    – David Thomas Oct 21 '21 at 19:37

0 Answers0