Skip to content

Instantly share code, notes, and snippets.

@bryanjamesmiller
Created February 12, 2015 02:29
Show Gist options
  • Save bryanjamesmiller/a30ff89144b8446774a0 to your computer and use it in GitHub Desktop.
Save bryanjamesmiller/a30ff89144b8446774a0 to your computer and use it in GitHub Desktop.
another way
$(document).ready(function(){
$('button').click(function() {
var $button = $(this),
test = $button.text() === 'Expand',
test2 = $button.text() === 'Collapse';
if(test)
{
$button.text('Collapse');
}
else if(test2)
{
$button.text('Expand');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment