Computer Science, asked by jason1765, 1 year ago

How to convert string with html tags to array in javascript?

Answers

Answered by vernon10112
0

Is there a way to convert HTML like:

<div>
<a href="#"></a>
<span></span>
</div>
or any other HTML string into DOM element? (So that I could use appendChild()). I know that I can do .innerHTML and .innerText, but that is not what I want -- I literally want to be capable of converting a dynamic HTML string into a DOM element so that I could pass it in a .appendChild().

Similar questions