Skip to content

Instantly share code, notes, and snippets.

@abhishek-9ithub
Created November 25, 2017 09:24
Show Gist options
  • Save abhishek-9ithub/86cfb3a67967c0bbeb29f8e97db97dbc to your computer and use it in GitHub Desktop.
Save abhishek-9ithub/86cfb3a67967c0bbeb29f8e97db97dbc to your computer and use it in GitHub Desktop.
place custom sorting classes on table
$(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