Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:17+00:00 2026-05-26T22:41:17+00:00

My HTML is like this: <div> <div class=action>Show details</div> <div>Some hidden details</div> </div> My

  • 0

My HTML is like this:

<div>
    <div class="action">Show details</div>
    <div>Some hidden details</div>
</div>

My current JS is this:

$(".action").click(function(e) {
        e.preventDefault();
        $(this).next("div").slideToggle('slow');
    });

How can I also change the content of the action div to “Hide details” / “Show details” on each toggle?

So it’s clear to users that clicking on the link again will close the div.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:41:18+00:00Added an answer on May 26, 2026 at 10:41 pm
    $(".action").click(function(e) {
        e.preventDefault();
        var $container = $(this).next("div");
        var title = $container.is(':visible') ? "Show details" : "Hide details" ;
        $container.slideToggle('slow');
        $(this).text(title);
    });
    

    Code: http://jsfiddle.net/45Vz9/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some HTML like this: <div id=MyDiv> <div class=Class1> <div class=SClass1></div> </div> <div
I have an html like this: <div id=container1> <div class=dragme>drag me</div> </div> <div id=container2>
My Html is like this: <div style=height: 90px; class=tabtextarea> <div>Description:</div> <textarea style=height: 85px;>TEXT...</textarea> </div>
i have a html text like this: <div id=content> <p>para1</p> <p>para2</p> <p>para3</p> <p class=break>para4</p>
Say I have jquery code like this: html += '<div class=index>' + item.index +
My html is like this <div id=rsContainer> <table id=rsTable><!-- DATA HERE --></table> </div> and
I have HTML code like this : <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a>
I wrote my html page like this: <div> <img src=Natural1.jpg id=img1 > <audio src=sound.mp3
I have a div directly under the body. My HTML looks like this: <body>
It's a really simple problem. I've got HTML code like this : <div> <img

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.