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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:08:32+00:00 2026-06-05T07:08:32+00:00

I would like to expand and collapse the nodes when i click +/- symbols

  • 0

I would like to expand and collapse the nodes when i click +/- symbols and also when i click the text (hyperlink) next to each symbol. I want to collapse the previous node and expand the node which i clicked. I am using the following method.

$(document).ready(function(){

    // first example
    $("#navigation").treeview({
        persist: "cookie", //I want to store the state and come back to the state when i reload the page.
        collapsed: true, //I want to collapse all the nodes when i load.
        unique:true //I want to open only one node at a time
    });
});

I have tried lot of options but none of them worked. Please help me.

My HTML is:

 <ul id="navigation" class="treeview">
            <li>
                <div>
                    <a href="#">Marketing</a>
                </div>
                <ul>
                    <li>
                        <div>
                            <a href="#">Joysticks</a>
                        </div>
                        <ul>
                            <li>
                                <div>
                                    <a href="#">Intel</a>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <a href="#">Microsoft</a>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <a href="#">Sony</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <div>
                            <a href="#">Laptops</a>
                        </div>
                        <ul>
                            <li>
                                <div>
                                    <a href="#">Apple</a>
                                </div>
                                <ul>
                                    <li>
                                        <div>
                                            <a href="#">iMac</a>
                                        </div>
                                    </li>
                                    <li>
                                        <div>
                                            <a href="#">MacBook Air</a>
                                        </div>
                                    </li>
                                    <li>
                                        <div>
                                            <a href="#">MacBook Pro</a>
                                        </div>
                                    </li>
                                    <li>
                                        <div>
                                            <a href="#">Accessories</a>
                                        </div>
                                    </li>
                                </ul>
                            </li>
                            <li>
                                <div>
                                    <a href="#">Dell</a>
                                </div>
                                <ul>
                                    <li>
                                        <div>
                                            <a href="#">Inspiron</a>
                                        </div>
                                    </li>
                                    <li>
                                        <div>
                                            <a href="#">XPS</a>
                                        </div>
                                    </li>
                                </ul>
                            </li>
                            <li>
                                <div>
                                    <a href="#">Sony</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <div>
                            <a href="#">Phones</a>
                        </div>
                        <ul>
                            <li>
                                <div>
                                    <a href="#">LG</a>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <a href="#">Motorola</a>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <a href="#">Samsung</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                </ul>
            </li>
        </ul>
  • 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-05T07:08:33+00:00Added an answer on June 5, 2026 at 7:08 am

    You’re code behind generates <div><a href="#">Marketing</a></div>. Apparently, there is something wrong with having two levels of tags. Change the structure to just <span>Marketing</span> and it will work. My guess is that you could use <a> or <div> if you prefer.

    I’ve made those changes here and it works:
    http://jsfiddle.net/lbstr/V7A6A/2/

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

Sidebar

Related Questions

I Would like to have two buttons on my site. Expand All, collapse All
I would like to expand/collapse a div when this div is clicked on. It
I would like to be able to collapse and expand object details when showing
I'm using this to expand or collapse some div $(h3.trigger).click(function(){ $(this).toggleClass(active).next().fadeToggle(500,swing); return false; });
I would like to expand the functionality of some class using class_eval. I would
In the Jquery example below, I would like to expand $(this) before it is
I have pictures that I would like to have expand across an entire page
I would like to develop a menubar where the tabs expand upwards as soon
I'm looking for a way to expand/collapse all table rows at one click. Here
I currently would like to expand my knowledge on Spring MVC so I am

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.