?
Solved

Select/Deselect all in a <ul> 'tree' structure

Posted on 2011-09-09
2
Medium Priority
?
351 Views
Last Modified: 2012-05-12
Hello Experts,

Please see the following link for my progress so far:

Example

(To be honest, I have had to delete the jquery as I simply can't get it to work!)

I am trying to achieve the following:

When a user clicks on the Select all box, I want ALL the children (including any grandchildren etc) to be ticked. Likewise, if the user then untick the box, it should do the opposite.

Many thanks for any help!
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: 36510225
try : http://jsfiddle.net/ZzTZP/

$(":checkbox", "li:contains('Select All')").click(function() {
    $(this).closest("ul").find(":checkbox").attr("checked", $(this).is(":checked") );
})

Open in new window


you may create/set a class for each checkbox "Select All" and use :

"li.selectAllClass" instead  "li:contains('Select All')"
0
 

Author Closing Comment

by:jagku
ID: 36510306
Many Thanks.
As suggested, I added <li class="selectAll">
and changed the

$(":checkbox", "li:contains('Select All')").click(function() {

to

$(":checkbox", "li.selectAll").click(function() {
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

ASP.NET AJAX callbacks to web service are becoming very popular and unavoidable these days. The feel that the user gets when only a part of the page is updated without even hindering the UI is the advantage that the callbacks offer. The wait for the…
Today I am discussing AJAX problems in IE7 and I bet this will helps many guys out here who have problems with AJAX work. Lets start with the discovery of problem and then we will talk about its different solutions. My last two projects included …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 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