<?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>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Konrad</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-83723</link>
		<dc:creator>Konrad</dc:creator>
		<pubDate>Mon, 23 May 2011 13:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-83723</guid>
		<description>Thank you. This is one of a few tutorials which are understandable AND work right away..!</description>
		<content:encoded><![CDATA[<p>Thank you. This is one of a few tutorials which are understandable AND work right away..!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Wallace</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-83629</link>
		<dc:creator>William Wallace</dc:creator>
		<pubDate>Tue, 19 Apr 2011 13:10:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-83629</guid>
		<description>I finally made the checkbox functionality just like radio buttons.

http://jsfiddle.net/markcoleman/UYkXS/2/

&lt;pre&gt;&lt;code&gt;$(&quot;#emp_grid tbody tr&quot;).click(function(e) {
    $(&quot;#emp_grid tbody tr&quot;).removeClass(&quot;selected&quot;);
    var $checkbox = $(this).find(&#039;:checkbox&#039;);
    $(&quot;#emp_grid :checkbox&quot;).not($checkbox).removeAttr(&quot;checked&quot;);
    if (e.target.type == &quot;checkbox&quot;) {

        // stop the bubbling to prevent firing the row&#039;s click event
        e.stopPropagation();
        $(this).filter(&#039;:has(:checkbox)&#039;).toggleClass(&#039;selected&#039;, $checkbox.attr(&#039;checked&#039;));
    } else {

        
        $checkbox.attr(&#039;checked&#039;, !$checkbox.attr(&#039;checked&#039;));
        $(this).filter(&#039;:has(:checkbox)&#039;).toggleClass(&#039;selected&#039;, $checkbox.attr(&#039;checked&#039;));
    }
});
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I finally made the checkbox functionality just like radio buttons.</p>
<p><a href="http://jsfiddle.net/markcoleman/UYkXS/2/" rel="nofollow">http://jsfiddle.net/markcoleman/UYkXS/2/</a></p>
<pre><code>$("#emp_grid tbody tr").click(function(e) {
    $("#emp_grid tbody tr").removeClass("selected");
    var $checkbox = $(this).find(':checkbox');
    $("#emp_grid :checkbox").not($checkbox).removeAttr("checked");
    if (e.target.type == "checkbox") {

        // stop the bubbling to prevent firing the row's click event
        e.stopPropagation();
        $(this).filter(':has(:checkbox)').toggleClass('selected', $checkbox.attr('checked'));
    } else {

        $checkbox.attr('checked', !$checkbox.attr('checked'));
        $(this).filter(':has(:checkbox)').toggleClass('selected', $checkbox.attr('checked'));
    }
});
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Burak</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-83447</link>
		<dc:creator>Burak</dc:creator>
		<pubDate>Sun, 06 Feb 2011 18:09:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-83447</guid>
		<description>Rizky, you need to remove &quot;dot&quot;. Try this;

$(&#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(&lt;strong&gt;selected&lt;/strong&gt;)&#039;).toggleClass(&#039;selected&#039;);
});</description>
		<content:encoded><![CDATA[<p>Rizky, you need to remove &#8220;dot&#8221;. Try this;</p>
<p>$(&#8216;input.checkall&#8217;).click(function() {<br />
  $(this).parents(&#8216;table&#8217;).find(&#8216;:checkbox&#8217;).attr(&#8216;checked&#8217;, this.checked);<br />
  $(this).parents(&#8216;table&#8217;).find(&#8216;tbody tr:not(<strong>selected</strong>)&#8217;).toggleClass(&#8216;selected&#8217;);<br />
});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leiyangkai</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-82993</link>
		<dc:creator>leiyangkai</dc:creator>
		<pubDate>Thu, 28 Oct 2010 04:27:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-82993</guid>
		<description>Dear Friend:
         i really need your help ,  i want to do something like this :
            first checkbox hidden , and when i click  the any other tr area . and the checkbox will be showed . and add the background in the  area . and the checkbox must be checked .
          when i click the tr area  second time that the checkbox will be hidden.
          looking forward to your answer , thanks so much and best wishes to you .</description>
		<content:encoded><![CDATA[<p>Dear Friend:<br />
         i really need your help ,  i want to do something like this :<br />
            first checkbox hidden , and when i click  the any other tr area . and the checkbox will be showed . and add the background in the  area . and the checkbox must be checked .<br />
          when i click the tr area  second time that the checkbox will be hidden.<br />
          looking forward to your answer , thanks so much and best wishes to you .</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-81880</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Thu, 16 Sep 2010 12:11:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-81880</guid>
		<description>Hi,
Probably your best bet would be to look for a grid plugin like this one:
http://www.trirand.com/blog/jqgrid/demo38/jqgrid.html</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Probably your best bet would be to look for a grid plugin like this one:<br />
<a href="http://www.trirand.com/blog/jqgrid/demo38/jqgrid.html" rel="nofollow">http://www.trirand.com/blog/jqgrid/demo38/jqgrid.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anirudh</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-81879</link>
		<dc:creator>anirudh</dc:creator>
		<pubDate>Thu, 16 Sep 2010 06:25:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-81879</guid>
		<description>Hi Karl:
Great expertise, and great help throughout! Thank you. I am not sure, if this is not common or you had addressed above (and I missed), I would like an example of table with both &#039;sortable columns &#039; and &#039;selectable rows&#039; . Is that possible at all?
Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi Karl:<br />
Great expertise, and great help throughout! Thank you. I am not sure, if this is not common or you had addressed above (and I missed), I would like an example of table with both &#8216;sortable columns &#8216; and &#8216;selectable rows&#8217; . Is that possible at all?<br />
Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Agustin</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-81739</link>
		<dc:creator>Agustin</dc:creator>
		<pubDate>Sun, 15 Aug 2010 18:15:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-81739</guid>
		<description>This is a nice code, worked perfectly! What If I wanna reset all the form?

&lt;code&gt;$(&quot;#textlink&quot;).click(function(){$(&quot;myForm input:checkbox&quot;).removeAttr(&#039;checked&#039;)&lt;/code&gt;

With this I can only reset the checkboxes but how I can also remove the &quot;selected&quot; class?

A simple &lt;code&gt;.removeClass(&#039;selected&#039;);&lt;/code&gt; doesn&#039;t work!

Thanks in advance :)</description>
		<content:encoded><![CDATA[<p>This is a nice code, worked perfectly! What If I wanna reset all the form?</p>
<p><code>$("#textlink").click(function(){$("myForm input:checkbox").removeAttr('checked')</code></p>
<p>With this I can only reset the checkboxes but how I can also remove the &#8220;selected&#8221; class?</p>
<p>A simple <code>.removeClass('selected');</code> doesn&#8217;t work!</p>
<p>Thanks in advance :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uday</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-80957</link>
		<dc:creator>Uday</dc:creator>
		<pubDate>Mon, 19 Jul 2010 11:33:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-80957</guid>
		<description>Thank you Karl, it&#039;s working :)</description>
		<content:encoded><![CDATA[<p>Thank you Karl, it&#8217;s working :)</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-80941</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Sun, 18 Jul 2010 00:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-80941</guid>
		<description>Hi Uday,

Something like this would work:

&lt;pre&gt;&lt;code&gt;
$(document).ready(function() {
  // use your own selector in the next line
  var $rows = $(&#039;#sometable tr&#039;);

  $rows.filter(function() {
    return !!$(this).find(&#039;:checkbox:checked&#039;).not(&#039;:disabled&#039;).length;
  }).addClass(&#039;selected&#039;);

  $rows.click(function(event) {
    if ( $(this).find(&#039;:checkbox&#039;).is(&#039;:disabled&#039;) ) {
      return false;
    }
    $(this).toggleClass(&#039;selected&#039;);
    if (event.target.type !== &#039;checkbox&#039;) {
      $(this).find(&#039;:checkbox&#039;).attr(&#039;checked&#039;, function() {
        return !this.checked;
      });
    }
  });
});&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Uday,</p>
<p>Something like this would work:</p>
<pre><code>
$(document).ready(function() {
  // use your own selector in the next line
  var $rows = $('#sometable tr');

  $rows.filter(function() {
    return !!$(this).find(':checkbox:checked').not(':disabled').length;
  }).addClass('selected');

  $rows.click(function(event) {
    if ( $(this).find(':checkbox').is(':disabled') ) {
      return false;
    }
    $(this).toggleClass('selected');
    if (event.target.type !== 'checkbox') {
      $(this).find(':checkbox').attr('checked', function() {
        return !this.checked;
      });
    }
  });
});</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uday</title>
		<link>http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click/comment-page-1#comment-80829</link>
		<dc:creator>Uday</dc:creator>
		<pubDate>Thu, 15 Jul 2010 13:24:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=165#comment-80829</guid>
		<description>I am new to jquery, how can i skip the disabled elements in the table, to avoid the toggel (checked and unchecked).</description>
		<content:encoded><![CDATA[<p>I am new to jquery, how can i skip the disabled elements in the table, to avoid the toggel (checked and unchecked).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 10/23 queries in 0.007 seconds using disk: basic
Object Caching 374/385 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 17:58:32 -->
