For Live Demo: Click here

HTML code snippet for content you want to hide or show:

Important Notes:

  • Use class=”expand” for heading
  • Use class=”collapse” for content you want to expand or collapse

Sample heading

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.

HTML code to display “Expand All” and “Collapse All” button:

Important Note:

  • Use class=”expandAll” for “Expand All” and “Collapse All” button.
  • [Collapse All]

    Code for CSS:


    • You can change style as you like
    • Do not change class name in css if you are not using same class name for HTML code.

    Code for JQuery:


                if($(this).html()=="[Expand All]")
                      $(this).html("[Collapse All]");
                      $(this).html("[Expand All]");

    Leave a Reply

    Your email address will not be published. Required fields are marked *