?
Solved

jquery Show tree if a child is selected

Posted on 2011-09-12
2
Medium Priority
?
593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There is basically two types of AJAX request in mootools. Request  and Request.HTML Request: Request is the basic XHR request class in MooTools. While not extremely useful on its own, it provides the basic functionality for both Request.HTM…
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

764 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