Skip to content

Instantly share code, notes, and snippets.

@Seldaek Seldaek/sort.js
Last active Aug 29, 2015

What would you like to do?
PHP Wiki Vote Chrono-sort
// Run this in web console
var rows = $('table tr').get();
rows.sort(function(a, b) {
var keyA = $(a).find('img[src="/lib/images/success.png"]').attr('title') || '0';
var keyB = $(b).find('img[src="/lib/images/success.png"]').attr('title') || '0';
if (keyA < keyB) return -1; if (keyA > keyB) return 1; return 0;
$.each(rows, function(index, row) {$('table tbody').append(row);});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.