MediaWiki:ShowHide.js

/* Custom show/hide function */ /* For usage in the templates HideButton and HideContent */

// Inserts initial text $(function {   var x = document.getElementsByClassName("showhide");    var i;    for (i = 0; i < x.length; i++) {        if (x[i].innerHTML === 'show') {            x[i].innerHTML = 'show';        } else {            x[i].innerHTML = 'hide';        }    } });

// Changes text on click $('.showhide').click(function {   if ($(this).html === 'show') {        $(this).html('hide');    } else {        $(this).html('show');    } });