Languages
[Edit]
EN

Dirask - sort cross technology table

8 points
Created by:
Root-ssh
175400

Quick solution:

(function sort(columnIndex) {
    //const table = document.querySelector('table');
    const table = document.querySelector('.cke_wysiwyg_frame')
                .contentWindow.document.querySelector('table');

    const rows = table.rows;

    outer:
    while (true) {
        for (let index = 1; index < rows.length - 1; index++) {
            const row1 = rows[index];
            const row2 = rows[index + 1];

            const text1 = row1.cells[columnIndex].innerText.toLowerCase();
            const text2 = row2.cells[columnIndex].innerText.toLowerCase();

            if (text1 > text2) {
                row1.parentNode.insertBefore(row2, row1);
                continue outer;
            }
        }
        break;
    }
})(0);

See also:

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Cross technology - common problems

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join