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

  • Home
  • SEARCH
  • 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 3609100
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:35:03+00:00 2026-05-18T21:35:03+00:00

I am making tree with the help of jquery in the tree whenever there

  • 0

I am making tree with the help of jquery in the tree whenever there is more than one child for a particular child i want to gave a toggle effect.it means that there should be a plus icon on click of it tree should expand and minus image should come on click of minus tree should collapse and plus image should come.

how to develop this any working example of tree node will be helpful

In this manner i have used your function

function createSpanImageNode(spnNew) {
    var spnImage = document.createElement("span");
    spnImage.id = spnNew + "_" + "spn1";
    $(spnImage).addClass('SpanPlus');
    spnImage.setAttribute('onclick', 'toogleNode("' + spnImage.id + '")');
    return spnImage;
}

function toogleNode(spnID) {
        debugger;
        var dv = $("#" + spnID).parents("div:first");
        var chkUl = $(dv).find('ul').length;
        if (chkUl.length > 0) {
            if ($("#" + spnID).hasClass('SpanPlus'))
                $("#" + spnID).removeClass('SpanPlus').addClass('SpanMinus');
            else
                $("#" + spnID).removeClass('SpanMinus').addClass('SpanPlus');
            $(dv).find('ul').animate({ height: 'toggle' });
        }
    }

But when it gets chkul value 1 it means it has to go inside the if
loop but it did not go inside i dont why can you tell me.

  • 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-18T21:35:03+00:00Added an answer on May 18, 2026 at 9:35 pm

    I’m not sure about your tree structure but you can use something like this.

    $(img.handle).click(function(){
        if($(this).hasClass('plus'))
            $(this).removerClass('plus').addClass('minus');
        else
            $(this).removerClass('minus').addClass('plus');
        $(this).find('child').animate({height: 'toggle'});
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am making a tree with the help javascript and jquery . I the
I can't figure this one out, and I may be making it harder than
I'm making a simple test app that navigates a category tree. Whenever I try
Making UML sequence diagram in VS 2010RC I've observed that there is no activation
Making websites that appear correctly in IE is a big problem. Is there any
This question is more a semantic-algorithmic-data-structure question than a F# syntactically question. I have
can you advice what to use for making tree structured text editor? I used
I am making a python tree visualizer using wxPython. It would be used like
Python noob using 2.7 on Windows. I'm working on making a hierarchy tree view
I'm making a todo list program using windows forms for one of my university

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.