<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To: Check all uncheck all and invert checkboxes using jquery</title>
	<atom:link href="http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/</link>
	<description>By web developers for web developers</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:58:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jonathan Toledo</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-9112</link>
		<dc:creator>Jonathan Toledo</dc:creator>
		<pubDate>Fri, 01 Oct 2010 14:41:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-9112</guid>
		<description>Is a lot of code... here a most simple way...

$(&#039;#check-all&#039;).click(function(evt){
	if($(this).is(&#039;:checked&#039;)){
		$(&#039;input[type=&quot;checkbox&quot;]&#039;).attr(&#039;checked&#039;, &#039;checked&#039;);
	}
	else{
		$(&#039;input[type=&quot;checkbox&quot;]&#039;).removeAttr(&#039;checked&#039;);
	}
});

the selectors are the key to success..</description>
		<content:encoded><![CDATA[<p>Is a lot of code&#8230; here a most simple way&#8230;</p>
<p>$(&#8216;#check-all&#8217;).click(function(evt){<br />
	if($(this).is(&#8216;:checked&#8217;)){<br />
		$(&#8216;input[type="checkbox"]&#8216;).attr(&#8216;checked&#8217;, &#8216;checked&#8217;);<br />
	}<br />
	else{<br />
		$(&#8216;input[type="checkbox"]&#8216;).removeAttr(&#8216;checked&#8217;);<br />
	}<br />
});</p>
<p>the selectors are the key to success..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fm transmitter</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-9073</link>
		<dc:creator>fm transmitter</dc:creator>
		<pubDate>Tue, 28 Sep 2010 01:24:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-9073</guid>
		<description>Wow great. I didn’t know such things can be made with css only. I am pretty impressed</description>
		<content:encoded><![CDATA[<p>Wow great. I didn’t know such things can be made with css only. I am pretty impressed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dog training</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-8969</link>
		<dc:creator>Dog training</dc:creator>
		<pubDate>Sun, 19 Sep 2010 12:04:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-8969</guid>
		<description>That was a great post, informative and useful technique thanks for posting.</description>
		<content:encoded><![CDATA[<p>That was a great post, informative and useful technique thanks for posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to unlock iPhone 3.1.3</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6900</link>
		<dc:creator>How to unlock iPhone 3.1.3</dc:creator>
		<pubDate>Thu, 03 Jun 2010 15:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6900</guid>
		<description>jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing</description>
		<content:encoded><![CDATA[<p>jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Handmade Jewelry</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6894</link>
		<dc:creator>Handmade Jewelry</dc:creator>
		<pubDate>Thu, 03 Jun 2010 07:12:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6894</guid>
		<description>This is quite useful used it many times, and its easy too.</description>
		<content:encoded><![CDATA[<p>This is quite useful used it many times, and its easy too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Bathroom Suite</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6716</link>
		<dc:creator>White Bathroom Suite</dc:creator>
		<pubDate>Thu, 20 May 2010 11:20:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6716</guid>
		<description>jQuery also provides capabilities for developers to create plugins on top of the JavaScript library.</description>
		<content:encoded><![CDATA[<p>jQuery also provides capabilities for developers to create plugins on top of the JavaScript library.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6634</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Wed, 12 May 2010 11:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6634</guid>
		<description>jQuery also provides capabilities for developers to create plugins on top of the JavaScript library.</description>
		<content:encoded><![CDATA[<p>jQuery also provides capabilities for developers to create plugins on top of the JavaScript library.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stock Market</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6586</link>
		<dc:creator>Stock Market</dc:creator>
		<pubDate>Fri, 07 May 2010 15:32:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6586</guid>
		<description>jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.</description>
		<content:encoded><![CDATA[<p>jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dog training</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6543</link>
		<dc:creator>dog training</dc:creator>
		<pubDate>Tue, 04 May 2010 06:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6543</guid>
		<description>good saying.. cheers mate</description>
		<content:encoded><![CDATA[<p>good saying.. cheers mate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Free Games</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-6517</link>
		<dc:creator>Free Games</dc:creator>
		<pubDate>Sun, 02 May 2010 07:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-6517</guid>
		<description>Very nice article. thanx for sharing.</description>
		<content:encoded><![CDATA[<p>Very nice article. thanx for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gareth Edwards</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-5497</link>
		<dc:creator>Gareth Edwards</dc:creator>
		<pubDate>Mon, 12 Apr 2010 13:29:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-5497</guid>
		<description>First i have to say i love this, this almost solved a particular problem i have been having. Would it be possible to take it a step further. I am using this on a dynamically created table with collapsable sections. 





&lt;strong&gt;  GENERAL REQUIREMENTS&lt;/strong&gt;
225



ANNEX 6
14



JAROPS
135



NAVIGATION REQUIREMENTS FOR LONG RANGE FLIGHTS
76







&lt;strong&gt;  SPECIAL OPERATIONAL&lt;/strong&gt;
208



OPERATIONS MANUAL
11



ICING CONDITIONS
21



etc...etc..etc





I am using the following jquery to add the collapsable functionality and would like to incorporate what you have created here to control the checkboxes within each section.

$(document).ready(function() {

$(&#039;tr:not(.parent)&#039;).hide();

var toggleMinus = &#039;../images/icons/toggle_minus.png&#039;;
var togglePlus = &#039;../images/icons/toggle_plus.png&#039;;
var $subHead = $(&#039;tbody th:first-child&#039;);
$subHead.prepend(&#039;&#039;);
$(&#039;img&#039;, $subHead).addClass(&#039;clickable&#039;)
.click(function() {

    var toggleSrc = $(this).attr(&#039;src&#039;);
	
    if ( toggleSrc == toggleMinus ) {

      $(this).attr(&#039;src&#039;, togglePlus)

      .parents(&#039;tr&#039;).siblings().fadeOut(&#039;slow&#039;);

    } else{

      $(this).attr(&#039;src&#039;, toggleMinus)

      .parents(&#039;tr&#039;).siblings().fadeIn(&#039;slow&#039;);

};
});
})

I have incorporated your code, and it works perfectly but i would like it to control just the checkboxes in the rows associated ith their respective parents and vice versa. I am pretty sure it would be possible???? Sorry if this is a little long winded i have an idea in my head but i am new to javascript and jquery so it&#039;s like building a giant jigsaw in the dark.

Thanks</description>
		<content:encoded><![CDATA[<p>First i have to say i love this, this almost solved a particular problem i have been having. Would it be possible to take it a step further. I am using this on a dynamically created table with collapsable sections. </p>
<p><strong>  GENERAL REQUIREMENTS</strong><br />
225</p>
<p>ANNEX 6<br />
14</p>
<p>JAROPS<br />
135</p>
<p>NAVIGATION REQUIREMENTS FOR LONG RANGE FLIGHTS<br />
76</p>
<p><strong>  SPECIAL OPERATIONAL</strong><br />
208</p>
<p>OPERATIONS MANUAL<br />
11</p>
<p>ICING CONDITIONS<br />
21</p>
<p>etc&#8230;etc..etc</p>
<p>I am using the following jquery to add the collapsable functionality and would like to incorporate what you have created here to control the checkboxes within each section.</p>
<p>$(document).ready(function() {</p>
<p>$(&#8216;tr:not(.parent)&#8217;).hide();</p>
<p>var toggleMinus = &#8216;../images/icons/toggle_minus.png&#8217;;<br />
var togglePlus = &#8216;../images/icons/toggle_plus.png&#8217;;<br />
var $subHead = $(&#8216;tbody th:first-child&#8217;);<br />
$subHead.prepend(&#8221;);<br />
$(&#8216;img&#8217;, $subHead).addClass(&#8216;clickable&#8217;)<br />
.click(function() {</p>
<p>    var toggleSrc = $(this).attr(&#8216;src&#8217;);</p>
<p>    if ( toggleSrc == toggleMinus ) {</p>
<p>      $(this).attr(&#8216;src&#8217;, togglePlus)</p>
<p>      .parents(&#8216;tr&#8217;).siblings().fadeOut(&#8216;slow&#8217;);</p>
<p>    } else{</p>
<p>      $(this).attr(&#8216;src&#8217;, toggleMinus)</p>
<p>      .parents(&#8216;tr&#8217;).siblings().fadeIn(&#8216;slow&#8217;);</p>
<p>};<br />
});<br />
})</p>
<p>I have incorporated your code, and it works perfectly but i would like it to control just the checkboxes in the rows associated ith their respective parents and vice versa. I am pretty sure it would be possible???? Sorry if this is a little long winded i have an idea in my head but i am new to javascript and jquery so it&#8217;s like building a giant jigsaw in the dark.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dexter</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-3488</link>
		<dc:creator>Dexter</dc:creator>
		<pubDate>Tue, 16 Mar 2010 04:27:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-3488</guid>
		<description>@Eric Hynds

Thankyou for sharing Eric, that&#039;ll be so useful for everyone...</description>
		<content:encoded><![CDATA[<p>@Eric Hynds</p>
<p>Thankyou for sharing Eric, that&#8217;ll be so useful for everyone&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Hynds</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-3410</link>
		<dc:creator>Eric Hynds</dc:creator>
		<pubDate>Mon, 15 Mar 2010 13:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-3410</guid>
		<description>Hi, good technique.  A few performance improvements I&#039;d make:

1. Cache your queries.
2. Use the DOM element where possible instead of the &quot;jQuery&quot; way (this.checked over $(this).is(&quot;:checked&quot;)).
3. Give your class selectors a node type context (input.cb-element instead of just .cb-element).
4. Consider using bind() instead of live().  On something this simple live does not give you any benefits, until you have a huge amount of checkboxes or are adding/removing them dynamically. 

See below, or http://jsfiddle.net/KdHKh/

$(function(){
	var $inputs = $(&#039;input.cb-element&#039;), $checkall = $(&#039;input.checkAll&#039;);
	
	$checkall.live(&#039;change&#039;, function(){
		$inputs.attr(&#039;checked&#039;, this.checked ? &#039;checked&#039; : &#039;&#039;);
		$(this).next().text( this.checked ? &#039;Uncheck All&#039; : &#039;Check All&#039;);
	});
	
	$(&#039;a.invertSelection&#039;).live(&#039;click&#039;, function(){
		$inputs.each(function(){
			this.checked = !this.checked;
		}).trigger(&#039;change&#039;);
	});
	
	$inputs.live(&#039;change&#039;, function(){
		$inputs.length === $inputs.find(&#039;:checked&#039;).length 
			? $checkall.attr(&#039;checked&#039;, &#039;checked&#039;).next().text(&#039;Uncheck All&#039;) 
			: $checkall.removeAttr(&#039;checked&#039;).next().text( &#039;Check All&#039; );
	});
});</description>
		<content:encoded><![CDATA[<p>Hi, good technique.  A few performance improvements I&#8217;d make:</p>
<p>1. Cache your queries.<br />
2. Use the DOM element where possible instead of the &#8220;jQuery&#8221; way (this.checked over $(this).is(&#8220;:checked&#8221;)).<br />
3. Give your class selectors a node type context (input.cb-element instead of just .cb-element).<br />
4. Consider using bind() instead of live().  On something this simple live does not give you any benefits, until you have a huge amount of checkboxes or are adding/removing them dynamically. </p>
<p>See below, or <a href="http://jsfiddle.net/KdHKh/" rel="nofollow">http://jsfiddle.net/KdHKh/</a></p>
<p>$(function(){<br />
	var $inputs = $(&#8216;input.cb-element&#8217;), $checkall = $(&#8216;input.checkAll&#8217;);</p>
<p>	$checkall.live(&#8216;change&#8217;, function(){<br />
		$inputs.attr(&#8216;checked&#8217;, this.checked ? &#8216;checked&#8217; : &#8221;);<br />
		$(this).next().text( this.checked ? &#8216;Uncheck All&#8217; : &#8216;Check All&#8217;);<br />
	});</p>
<p>	$(&#8216;a.invertSelection&#8217;).live(&#8216;click&#8217;, function(){<br />
		$inputs.each(function(){<br />
			this.checked = !this.checked;<br />
		}).trigger(&#8216;change&#8217;);<br />
	});</p>
<p>	$inputs.live(&#8216;change&#8217;, function(){<br />
		$inputs.length === $inputs.find(&#8216;:checked&#8217;).length<br />
			? $checkall.attr(&#8216;checked&#8217;, &#8216;checked&#8217;).next().text(&#8216;Uncheck All&#8217;)<br />
			: $checkall.removeAttr(&#8216;checked&#8217;).next().text( &#8216;Check All&#8217; );<br />
	});<br />
});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: technotiger</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-3347</link>
		<dc:creator>technotiger</dc:creator>
		<pubDate>Mon, 15 Mar 2010 04:22:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-3347</guid>
		<description>nice one...I like it</description>
		<content:encoded><![CDATA[<p>nice one&#8230;I like it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: siddharth</title>
		<link>http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/comment-page-1/#comment-3338</link>
		<dc:creator>siddharth</dc:creator>
		<pubDate>Mon, 15 Mar 2010 02:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.webdeveloperjuice.com/?p=1063#comment-3338</guid>
		<description>Jquery is too nice thing . I also like jquery sliding widget in blogger . Thanks a lot</description>
		<content:encoded><![CDATA[<p>Jquery is too nice thing . I also like jquery sliding widget in blogger . Thanks a lot</p>
]]></content:encoded>
	</item>
</channel>
</rss>

