jQuery text switcher

by abenrob

HTML

<span id="toggler" title="Show Timeline" class="green">Show Timeline</span>

CSS

.red {
  color:red;
}

.green {
  color:green;
}

JavaScript

$('#toggler').toggle(
function() {
    $(this).html('<span title="Show All" class="red">Show All</span>');
}, function() {
    $(this).html('<span title="Show Timeline" class="green">Show Timeline</span>');
});