title: jQuery sort tables
body: <p>I took a lead form this post ( <a href="https://stackoverflow.com/questions/3160277/jquery-table-sort">jQuery table sort</a> ) - in trying to do what Im doing...</p>
  
  <p>the code is here.
  <a href="http://jsfiddle.net/daqGC/" rel="nofollow noreferrer">http://jsfiddle.net/daqGC/</a></p>
  
  <p>It's not working... any thoughts</p>
  
  <p>Here's the js code. the HTML can be found on jsFiddle.</p>
  
  <pre><code>var user_table = $( '#users' );
  $('#company_header, #user_header, #email_header, #type_header')
      .wrapInner('&lt;span title="sort this column"/&gt;')
      .each(function(){
  
          var th = $(this),
              thIndex = th.index(),
              inverse = false;
  
          th.click(function(){
  
              user_table.find('td').filter(function(){
  
                  return $(this).index() === thIndex;
  
              }).sortElements(function(a, b){
  
                  return $.text([a]) &gt; $.text([b]) ?
                      inverse ? -1 : 1
                      : inverse ? 1 : -1;
  
              }, function(){
  
                  // parentNode is the element we want to move
                  return this.parentNode; 
  
              });
  
              inverse = !inverse;
  
          });
  
      });
  </code></pre>
  
  <p>THx</p>