Click checkbox by clicking in the surrounding td
<p>I have a table that in one column has a checkbox.  I want the user to be able to check (or uncheck) the checkbox by clicking on the checkbox OR the surrounding td.  To complicate (possibly) things a little further, the checkbox has an onchange event set on it (i've put doSomething() in here just for clarity).  </p>

<p>Here's my current html: as you can see i'm using jQuery.</p>

<pre><code>&lt;tr&gt;
  &lt;td onclick="jQuery(this).children('input').click();"&gt;
    &lt;input id="dvdorders-77_packed" name="dvd_orders[77][packed]" onchange="doSomething()" type="checkbox" value="1"&gt;
  &lt;/td&gt;
&lt;/tr&gt;
</code></pre>

<p>I thought this was working ok but then noticed that when i click on the actual checkbox, this counts as a click on the checkbox AND a click on the td, effectively clicking twice on the checkbox and so setting it and unsetting it again instantly (and triggering doSomething() twice).</p>

<p>There must be a nicer way to do this - anyone?  thanks, max</p>
