I have a two function, that using a new format. I would like to change this code, but I need that this function did exactly the same.
first function:
let sts = $(".st--footer-column");
for (let i of sts) {
while (i.childElementCount) {
i.parentNode.appendChild(i.firstElementChild)
}
i.parentNode.removeChild(i)
}
second function:
let groups = $(".st-footer--navigation");
let child = groups.find('.st--footer-column');
if (!child.length) {
for (let i of groups) {
let childrens = i.children;
let stFooterColumn = document.createElement("div");
// add the class
stFooterColumn.classList.add("st--footer-column");
// add each child to the new div
while (childrens.length) {
stFooterColumn.appendChild(childrens[0])
}
// append the div to previews to group
i.appendChild(stFooterColumn)
}
}