I am Officially a jQuery Convert

Back to Listing

I am Officially a jQuery Convert


22 Apr, 2009


This just might be the most awesome JavaScript I have written in the better part of a decade.

function sortEnd() {  
  $('thead th', this).each(function() {
 

    var $className = $(this).attr('class');
    var $anchor = $('a', this);
    var titleText;

    switch ($className) {
      case "headerSortUp":
        titleText = $anchor.text() + ', sorted acending';
        break;
      case "headerSortDown":
        titleText = $anchor.text() + ', sorted decending';
        break;
      default:
        titleText = $anchor.text() + ', sort by';
    }

    $anchor.attr('title', titleText);
    $anchor.attr('alt', titleText);

  });
};
Share this story

Bobby Johnson

About Author

I am a passionate engineer with an interest in shipping quality software, building strong collaborative teams and continuous improvement of my skills, team and the product.

comments powered by Disqus
Back to top