Hello. I'm an interface admin on Encyclopædia Dramatica (where I go by "MarioMario456"). The wiki has this JavaScript that extends the MediaWiki custom toggle by allowing a toggle button with expand/collapse text anywhere (this is used on series templates). However, sometimes it doesn't work:
$(document).ready(function() { $(".collapsibletoggletext").click(function() { $(this).parent().children(".collapsibletoggletext").removeClass("hiddentext"); $(this).addClass("hiddentext"); }); });
For those JavaScript-illiterate, it's: When the page has loaded, when an object with the class "collapsibletoggletext" is clicked, all other objects with the class "collapsibletoggletext" in the parent have the class "hiddentext" (which has the CSS "display:none", meaning it's hidden) removed, while the "collapsibletoggletext" that was clicked has the "hiddentext" class added.
Here's an example:
[<span class="mw-customtoggle-example collapsibletoggle showhidetext"><span class="collapsibletoggletext hiddentext">Collapse</span><span class="collapsibletoggletext">Expand</span></span>] <div id="mw-customcollapsible-example" class="mw-collapsible mw-collapsed">Hello World!</div>