Answer the question
In order to leave comments, you need to log in
Why are the rows not sorted?
There is this script:
static sortRows() {
const tbody = document.getElementsByTagName('tbody')[0];
let rows = [];
for (let i = 0; i < tbody.children.length; i++) {
rows.push(tbody.children[i]);
}
console.log(rows);
rows.sort((a, b) => {
return a.innerHTML - b.innerHTML;
});
for (let i = 0; i < rows.length; i++) {
tbody.appendChild(rows[i]);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question