I can't get the following code to work that I copied from https://css-tricks.com/snippets/jquery/toggle-text/.
Can you also explain the purpose of ':visible'. Thanks.
Here's the fiddle and the code is copied below.
HTML:
<button id="more-less-options-button">more options</button>
JS
$("#more-less-options-button").click(function() {
var txt = $("#extra-options").is(':visible') ? 'more options' : 'less options';
$("#more-less-options-button").text(txt);
$("#extra-options").slideToggle();
});