Created
October 25, 2014 05:54
-
-
Save is8r/b169cf6914cb6c3be84d to your computer and use it in GitHub Desktop.
jQueryでtrをソートする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sortTrFilter(a, b) { | |
var _a = parseInt($(a).attr('data-id')); | |
var _b = parseInt($(b).attr('data-id')); | |
if (_a > _b) { | |
return 1; | |
} else { | |
return -1; | |
} | |
} | |
//howto | |
$table.html( | |
$table.find('tr').sort(sortTrFilter) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment