Solved

jquery Show tree if a child is selected

Posted on 2011-09-12
2
588 Views
Last Modified: 2012-05-12
Hello Experts,

Please see the following link:
Example

You will notice that I have commented out the jquery code that hides all the children.
You will also notice that Sub1->1 has been checked.

What I want to do is hide all the children (ie by uncommenting out the jquery)
and then have some jquery that looks at all the children.
If any are checked, then that parent (and all the parents before that) must be expanded.
In this example,

Main, all of Main's immediate children should be shown and Sub1's children should be shown.
Sub2 should be shown but it's children mustn't be shown as none are checked.

Please can you help me with this jquery?

Many Thanks!
0
Comment
Question by:jagku
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36521872
test page : http://jsfiddle.net/5Xkkf/

$('ul[id^="sub_"]').not( $(":checked").parents('ul[id^="sub_"]') ).hide();
0
 

Author Closing Comment

by:jagku
ID: 36521887
Excellent - all makes sense.
Many Thanks as always!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello World !, Thanks : My Sincere thanks to @Michael Male who encouraged me to write an article on this in my  blog (http://scribblejava.wordpress.com). Introduction:       There are several technical issues a developer may face in his…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now