Skip to content

Instantly share code, notes, and snippets.

@grok
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grok/5c351f5c9c297615d4fd to your computer and use it in GitHub Desktop.
Save grok/5c351f5c9c297615d4fd to your computer and use it in GitHub Desktop.
var states = {
'online' : 'offline',
'offline' : 'online',
'trial' : 'term',
'term' : 'trial',
'active' : 'expired' ,
'expired' : 'active'
};
var button = $('.trigger');
var target = event.target;
$.each(states, function(current, alternate) {
if(target == $('#' + current)) {
button.addClass(current).removeClass(alternate);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment