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 7835857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:50:24+00:00 2026-06-02T13:50:24+00:00

how can i make it to work, when clicked expand it and when clicked

  • 0

how can i make it to work, when clicked expand it and when clicked again collapse it…
if it is already expand then say hide and if it is already collapse then say show.

below is the code so far.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Collapsible Message Panels</title>
        <style type="text/css">
        *
        {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 12px;
        }
        #content
        {
            width: 200px;
            height: 100px;
            margin: 20px auto;
            padding: 20px;
            border: 1px dotted #999999;
            overflow: hidden;
            text-align: justify;
        }

    </style>

    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            // Hide the "view" div.
            $('one').hide();
            $('second').hide();
            // Watch for clicks on the "slide" link.
            $('div.slide').click(function () {
                // When clicked, toggle the "view" div.
                $('second').hide();
                $('one').slideToggle(400);
                return false;
            });
            $('div.slide1').click(function () {
                // When clicked, toggle the "view" div.
                $('one').hide();
                $('second').slideToggle(400);
                return false;
            });


        });
    </script>
</head>
<body>

    <div class="slide">
        <a href="#" class="slide">Disclaimer-1</a></div>
    <div class="slide1" >
        &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" class="slide1">Behavior</a></div>
    <div id="one" class="content">
       As you can see the structure, the elements of the menu are inside the div with class “menu_list”. 

    </div>
    <div id="second" class="content1">
       I’m not a good color chooser so please forgive me for the color combinations. Above CSS code is straight  
    </div>
    <br />
    <br />
</body>
</html>
  • 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-06-02T13:50:30+00:00Added an answer on June 2, 2026 at 1:50 pm

    Hiya Here you go man workingDemo http://jsfiddle.net/gVjFs/ second the 2 links together here http://jsfiddle.net/gVjFs/3/ (using span instead of div)

    Final with toggling text here http://jsfiddle.net/KpqvE/

    2nd demo from a fancy one as mentioned in the comments above: http://jsfiddle.net/5TfJy/2/ (this demo only have 2 tabs.

    Whichever suits you best bruv. And the code will make it clear what was missed i.e. # for ids.

    Hope this helps does the beahviour you mentioned 🙂

    HTML using span instead of div http://jsfiddle.net/KpqvE/

    <span class="slide">
        <a href="#" class="slide">Disclaimer-1</a></span>
    <span class="slide1" >
        &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" class="slide1">Behavior</a></span>
    <div id="one" class="content">
       As you can see the structure, the elements of the menu are inside the div with class “menu_list”. 
    
    </div>
    <div id="second" class="content1">
       I’m not a good color chooser so please forgive me for the color combinations. Above CSS code is straight  
    </div>
    <br />
    <br />​
    

    Jquery (old)

      $(document).ready(function () {
    
            // Hide the "view" div.
            $('#one').hide();
            $('#second').hide();
            // Watch for clicks on the "slide" link.
            $('div.slide').click(function () {
                // When clicked, toggle the "view" div.
                $('#second').hide();
                $('#one').slideToggle(400);
                return false;
            });
            $('div.slide1').click(function () {
                // When clicked, toggle the "view" div.
                $('#one').hide();
                $('#second').slideToggle(400);
                return false;
            });
    
    
        });​
    

    Updated Jquery code

    $(document).ready(function() {
    
        // Hide the "view" div.
        $('#one').hide();
        $('#second').hide();
        // Watch for clicks on the "slide" link.
        $('span.slide').click(function() {
            // When clicked, toggle the "view" div.
            $('#second').hide();
            $('#one').slideToggle(400, function() {
    
                if ($(this).is(":visible"))
                  $('span.slide > a').text('hide Disc');
                else
                  $('span.slide > a').text('Disclaimer-1');
    
            });
            return false;
        });
        $('span.slide1').click(function() {
            // When clicked, toggle the "view" div.
            $('#one').hide();
            $('#second').slideToggle(400, function() {
    
                if ($(this).is(":visible"))
                  $('span.slide1 > a').text('hide Behavior');
                else
                  $('span.slide1 > a').text('Behavior');
    
            });
            return false;
        });
    
    
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name,
There is a weird code here that I need to make work.. can you
now I can make it work with user-profile.tpl.php page,all this page does is to
I need to have two UITableViews on one UIView. I can make it work
how can I make this work? $current_id=5; SELECT Id FROM table1 WHERE Output='yes' and
I'm trying to do the following in jquery but can't make it work .
I found this great Tablesorter plugin for jQuery but I can't make it work
This one seems to be a simple problem, but I can't make it work
Short story: I can't make precompiled headers work properly with gcc -c option. Long
I have multimodule project. Can I make it somehow work that when calling compile

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.