With so many great answers, I thought I would drop another mix. This, unlike others, will allow you to easily navigate through any number of messages:
var index = 0, messg = [ "PUSH ME", "DON'T PUSH ME", "I'M SO CONFUSED!" ]; $(".pushme").on("click", function() { $(this).text(function(index, text){ index = $.inArray(text, messg); return messg[++index % messg.length]; }); }ββββββββββββββββββββββββββββββββββββββββββββββ);β
Demo: http://jsfiddle.net/DQK4v/2/
Sampson Nov 30 '12 at 9:01 2012-11-30 21:01
source share