apamphilon

Change button text on click using ternary operator.

// show more/less text on button
$('.button-elm').on('click', function() {
  // get text for the button
  var text = $(this).text();
  // set text according to current text
  $(this).text(text == 'Show more' ? 'Show less' : 'Show more');
});

Comments: