Created
November 25, 2017 09:24
-
-
Save abhishek-9ithub/86cfb3a67967c0bbeb29f8e97db97dbc to your computer and use it in GitHub Desktop.
place custom sorting classes on table
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(){ | |
var asc = false; | |
$('.sortable th').click(function(){ | |
if($(this).hasClass('sorting_asc')){ | |
$(this).addClass('sorting_desc'); | |
$(this).removeClass('sorting_asc'); | |
}else{ | |
$('.sortable th').each(function(){ | |
$(this).removeClass('sorting_asc'); | |
$(this).removeClass('sorting_desc'); | |
$(this).addClass('sorting'); | |
}); | |
$(this).addClass('sorting_asc'); | |
$(this).removeClass('sorting_desc'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment