JSFiddle - React, Tailwind, and code Playground
by Dhanck
HTML
<div id="mytextarea" class="panel1"><p>This <strong>message</strong> contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. You cannot <em>use</em> or forward any attachments in the email. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. Company X, Suite# 1, Street, City, Country, www.company.com</p></div>
JavaScript
var alldescendants = [];
var t = document.getElementById('mytextarea').childNodes;
for (i = 0; i < t.length; i++)
if (t[i].nodeType == 1)
recurseAndAdd(t[i], alldescendants);
function recurseAndAdd(el, descendants) {
descendants.push(el.id[i]);
var children = el.childNodes;
for (i = 0; i < children.length; i++) {
if (children[i].nodeType == 1) {
recurseAndAdd(children[i]);
console.log();
}
}
}