Toggle Text w/ jQuery - Plugin

Handy snippet of code that lets you toggle the text between 2 given values. Visit this page for a demonstration.


(function($){
  $.fn.extend({
    toggleText: function(on, off){
      this.text(this.text() === on ? off : on);
    }
  });
})(jQuery);

Files, Links & Downloads