<?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: Quick Tip: Click Table Row to Trigger a Checkbox Click</title>
	<atom:link href="http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Sat, 13 Mar 2010 15:20:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rizky</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-79342</link>
		<dc:creator>Rizky</dc:creator>
		<pubDate>Fri, 11 Dec 2009 05:05:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-79342</guid>
		<description>Nice tip.. Really saves me a lot of time :D

Btw, I&#039;m having trouble implementing this with a &quot;check all&quot; button that selects and highlights all rows.

my script is like this:
&lt;pre&gt;&lt;code&gt;$(&#039;input.checkall&#039;).click(function() {
  $(this).parents(&#039;table&#039;).find(&#039;:checkbox&#039;).attr(&#039;checked&#039;, this.checked);
  $(this).parents(&#039;table&#039;).find(&#039;tbody tr:not(.selected)&#039;).toggleClass(&#039;selected&#039;);
});
&lt;/code&gt;&lt;/pre&gt;

But when I uncheck the &quot;select all&quot; checkbox all the table rows are still highlighted.
I know the problem is on the &#039;tbody tr:not(.selected)&#039; selector. But can somebody point me to the right direction? :D

Thx.</description>
		<content:encoded><![CDATA[<p>Nice tip.. Really saves me a lot of time :D</p>
<p>Btw, I&#8217;m having trouble implementing this with a &#8220;check all&#8221; button that selects and highlights all rows.</p>
<p>my script is like this:</p>
<pre><code>$('input.checkall').click(function() {
  $(this).parents('table').find(':checkbox').attr('checked', this.checked);
  $(this).parents('table').find('tbody tr:not(.selected)').toggleClass('selected');
});
</code></pre>
<p>But when I uncheck the &#8220;select all&#8221; checkbox all the table rows are still highlighted.<br />
I know the problem is on the &#8216;tbody tr:not(.selected)&#8217; selector. But can somebody point me to the right direction? :D</p>
<p>Thx.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-79192</link>
		<dc:creator>Jens</dc:creator>
		<pubDate>Sat, 21 Nov 2009 14:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-79192</guid>
		<description>Hi Kris,

thx for the provided solution.
How do I add the &quot;selected&quot; class to the tr? It does not work for me...</description>
		<content:encoded><![CDATA[<p>Hi Kris,</p>
<p>thx for the provided solution.<br />
How do I add the &#8220;selected&#8221; class to the tr? It does not work for me&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Buarao</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-78733</link>
		<dc:creator>Joseph Buarao</dc:creator>
		<pubDate>Tue, 15 Sep 2009 11:13:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-78733</guid>
		<description>A really  Like this site.. but i want to have a printable copy of this tutorials , could you please send it to me.. Actually Im using mootools, but i want to try jquery because i want to find out which better..</description>
		<content:encoded><![CDATA[<p>A really  Like this site.. but i want to have a printable copy of this tutorials , could you please send it to me.. Actually Im using mootools, but i want to try jquery because i want to find out which better..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77742</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 29 Jun 2009 10:59:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77742</guid>
		<description>To make it clear, there is an important number in column 1 in each row.  The table is generated by PHP, so I can use this number elsewhere if needed.</description>
		<content:encoded><![CDATA[<p>To make it clear, there is an important number in column 1 in each row.  The table is generated by PHP, so I can use this number elsewhere if needed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77741</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 29 Jun 2009 10:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77741</guid>
		<description>I have a table of data, including one cell containing an important number.

When I click on a row, or a cell containing a href in that rowrow, how can I use this number, in a function call?  (It&#039;s actually an ajax call, but I guess that&#039;s not important).

Thanks for any help.</description>
		<content:encoded><![CDATA[<p>I have a table of data, including one cell containing an important number.</p>
<p>When I click on a row, or a cell containing a href in that rowrow, how can I use this number, in a function call?  (It&#8217;s actually an ajax call, but I guess that&#8217;s not important).</p>
<p>Thanks for any help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77716</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Sat, 27 Jun 2009 03:59:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77716</guid>
		<description>Hey, no problem, Dylan. Let me guess ... you&#039;re clicking on labels? If that&#039;s the case, then you need to add this at the end of that script:
&lt;pre&gt;&lt;code&gt;      if (event.target.nodeName === &#039;LABEL&#039;) {
        return false;
      }
&lt;/code&gt;&lt;/pre&gt;

I put together a &lt;a href=&quot;http://test.learningjquery.com/li-checkboxes.html&quot; rel=&quot;nofollow&quot;&gt;quick demo for you&lt;/a&gt;. Let me know if it still doesn&#039;t work.</description>
		<content:encoded><![CDATA[<p>Hey, no problem, Dylan. Let me guess &#8230; you&#8217;re clicking on labels? If that&#8217;s the case, then you need to add this at the end of that script:</p>
<pre><code>      if (event.target.nodeName === 'LABEL') {
        return false;
      }
</code></pre>
<p>I put together a <a href="http://test.learningjquery.com/li-checkboxes.html" rel="nofollow">quick demo for you</a>. Let me know if it still doesn&#8217;t work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan MacDonald</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77715</link>
		<dc:creator>Dylan MacDonald</dc:creator>
		<pubDate>Sat, 27 Jun 2009 02:40:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77715</guid>
		<description>Sorry forget my allusion to the hover effect.  It&#039;s the select and checked that doesn&#039;t work altogether.</description>
		<content:encoded><![CDATA[<p>Sorry forget my allusion to the hover effect.  It&#8217;s the select and checked that doesn&#8217;t work altogether.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan MacDonald</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77711</link>
		<dc:creator>Dylan MacDonald</dc:creator>
		<pubDate>Fri, 26 Jun 2009 23:46:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77711</guid>
		<description>I tried almost every example here and it didn&#039;t work as advertised.  Sometimes I got the hover effcet, sometimes the select effect, sometimes the checkbox was checked, but never all three.  What am I doing wrong?

&lt;pre&gt;&lt;code&gt;
$(&quot;.productGrid.samplesGrid ul li&quot;)
			.filter(&#039;:has(:checkbox:checked)&#039;)
			.addClass(&#039;selected&#039;)
			.end()
			.live(&#039;click&#039;, function(event)
			{
			$(this).toggleClass(&quot;selected&quot;);

			if (event.target.type !== &quot;checkbox&quot;)
			{
			checkbox = $(&quot;:checkbox&quot;, this);
			checkbox.attr(&quot;checked&quot;, checkbox.is(&#039;:not(:checked)&#039;));
			}
			});
&lt;/code&gt;&lt;/pre&gt;

and yes this is included within a document.ready function in my code.

Thanks.</description>
		<content:encoded><![CDATA[<p>I tried almost every example here and it didn&#8217;t work as advertised.  Sometimes I got the hover effcet, sometimes the select effect, sometimes the checkbox was checked, but never all three.  What am I doing wrong?</p>
<pre><code>
$(".productGrid.samplesGrid ul li")
			.filter(':has(:checkbox:checked)')
			.addClass('selected')
			.end()
			.live('click', function(event)
			{
			$(this).toggleClass("selected");

			if (event.target.type !== "checkbox")
			{
			checkbox = $(":checkbox", this);
			checkbox.attr("checked", checkbox.is(':not(:checked)'));
			}
			});
</code></pre>
<p>and yes this is included within a document.ready function in my code.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77517</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Tue, 16 Jun 2009 19:25:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77517</guid>
		<description>Hi Josh,

There is no such nodeName as checkbox. The former code sample is looking for an element with&lt;code&gt; type=&quot;checkbox&quot;&lt;/code&gt;, so it matches all &lt;code&gt;&lt;input type=&quot;checkbox&quot;&gt; &lt;/code&gt;elements.</description>
		<content:encoded><![CDATA[<p>Hi Josh,</p>
<p>There is no such nodeName as checkbox. The former code sample is looking for an element with<code> type="checkbox"</code>, so it matches all <code>&lt;input type="checkbox"&gt; </code>elements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-77480</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Tue, 16 Jun 2009 14:34:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-77480</guid>
		<description>I&#039;m new to jQuery, so could someone explain why this works

&lt;pre&gt;&lt;code&gt;
$(&#039;#table_1 tr&#039;).click(function(event) {
     if (event.target.type != &#039;checkbox&#039; &amp;&amp; event.target.nodeName != &#039;LABEL&#039;) {
          $(&#039;input:checkbox&#039;, this).trigger(&#039;click&#039;);
     }
});
&lt;/code&gt;&lt;/pre&gt;

and this doesn&#039;t

&lt;pre&gt;&lt;code&gt;
$(&#039;#table_1 tr&#039;).click(function(event) {
     if (event.target.nodeName!= &#039;CHECKBOX&#039; &amp;&amp; event.target.nodeName != &#039;LABEL&#039;) {
          $(&#039;input:checkbox&#039;, this).trigger(&#039;click&#039;);
     }
});
&lt;/code&gt;&lt;/pre&gt;

Is the former the best way to avoid triggering the event when a label is clicked?</description>
		<content:encoded><![CDATA[<p>I&#8217;m new to jQuery, so could someone explain why this works</p>
<pre><code>
$('#table_1 tr').click(function(event) {
     if (event.target.type != 'checkbox' &amp;&amp; event.target.nodeName != 'LABEL') {
          $('input:checkbox', this).trigger('click');
     }
});
</code></pre>
<p>and this doesn&#8217;t</p>
<pre><code>
$('#table_1 tr').click(function(event) {
     if (event.target.nodeName!= 'CHECKBOX' &amp;&amp; event.target.nodeName != 'LABEL') {
          $('input:checkbox', this).trigger('click');
     }
});
</code></pre>
<p>Is the former the best way to avoid triggering the event when a label is clicked?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
