 <p>This should work:</p> <pre><code>$(".checkall").click(function(){ var $table = $(this).closest("table"); var col = $(this).closest("tr").children().index($(this).closest("td")); var index = col + 1; // offset for nth-child $table.find("td:nth-child("+index+") input:checkbox").attr("checked",$(this).is(":checked")); }); </code></pre> <p><a href="http://jsfiddle.net/XBA4J/2/" rel="nofollow">jsfiddle.net</a></p>