JQuery Sort Table by Table ID

I am hopeful that somebody can help me alter this JQuery Code so that it will sort elements by calling by ‘table id’ rather than ‘table’. The issue is that my pages contain multiple tables and I would like the table sort to function based on one particular table identified by an ID. This functions using the Jquery Sort Elements plugin. Any Ideas?

https://raw.github.com/padolsey/jQuery-Plugins/master/sortElements/jquery.sortElements.js

$  (window).load(function(){
    var table = $  ('table');

    $  ('#facility_header, #city_header')
        .wrapInner('<span title="sort this column"/>')
        .each(function(){

            var th = $  (this),
                thIndex = th.index(),
                inverse = false;

            th.click(function(){

                table.find('td').filter(function(){

                    return $  (this).index() === thIndex;

                }).sortElements(function(a, b){

                    return $  .text([a]) > $  .text([b]) ?
                        inverse ? -1 : 1
                        : inverse ? 1 : -1;

                }, function(){

                    // parentNode is the element we want to move
                    return this.parentNode; 

                });

                inverse = !inverse;

            });

        });

});//]]>

newest questions tagged jquery – Stack Overflow

Tags: , ,

About Admin