Skip to content

Instantly share code, notes, and snippets.

@kapusta
Created September 1, 2016 21:12
Show Gist options
  • Save kapusta/a5a5714af34198bb8a2325f7069d86d3 to your computer and use it in GitHub Desktop.
Save kapusta/a5a5714af34198bb8a2325f7069d86d3 to your computer and use it in GitHub Desktop.
the answer to a question i was asked years ago, but sans jQuery
var tbl = document.querySelectorAll('table.someId');
var rows = Array.from(tbl.querySelectorAll('tr')).filter(function(row, idx) { return (idx % 2);});
tbl.removeChild(tbl.querySelector('tbody'));
rows.forEach(function (row) {
tbl.appendChild(row);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment