When your website means business.

Javascript, jQuery | Type: JavascriptjQuery Better Show-Hide

A show-hide that still works (last used mid-2021); changes toggle content.

jQuery(function($) {
    $(document).ready(function() { // this tells jquery to run the function below once the DOM is ready
var showText="Show"; // choose text for the show/hide link
var hideText="Hide";
    $(".toggle").prev().append(' '+showText+'»'); // append show/hide links to the element directly preceding the element with a class of "toggle"
    $('.toggle').hide(); // hide all of the elements with a class of 'toggle'
    $('a.toggleLink').click(function() { // capture clicks on the toggle links
    if ($(this).text()==showText) { // change the link text depending on whether the element is shown or hidden
    } else {
    $(this).parent().next('.toggle').toggle('fast'); // toggle the display
    return false; // return false so any link destination is not followed

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Cookies Notice