E
E
Egor S2015-10-19 01:46:55
JavaScript
Egor S, 2015-10-19 01:46:55

How to move a row to the beginning of tbody?

We need to move the row to the beginning of tbody. I did this, but then parentNode is not inherited, etc. Can this be done in another way?

var node=row.cloneNode(true);
                    row.parentNode.insertBefore(node,row.parentNode.rows[0]);
                    row.parentNode.removeChild(row);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-10-19
@mortyyyy

You don't need to clone the element or delete it. Just one line ( jsfiddle.net/st2m9cd5 ):

row.parentNode.insertBefore(row, row.parentNode.rows[0]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question