Why would a script differ in evaluating 'element.checked' in the same script, acting on different table-rows with the same structure?
<p>I wrote an answer to this question: <a href="http://stackoverflow.com/questions/10340258/fetch-content-of-next-td-on-checkbox-click/10340463">Fetch content of next td on checkbox click</a>, the answer was accepted (as of writing this question).</p>

<p>The intent was to find the text-value of the table-cell following the current cell that contained the input checkbox; for the second row this works (in Chrome 18/WinXP), but in the first row the evaluation <code>console.log(that.checked);</code> evaluates to false (regardless, so far as I can see, of it being checked or not).</p>

<p>The supplied HTML:</p>

<pre><code>&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;input type=checkbox name=t&gt;
        &lt;/td&gt;
        &lt;td width=25%&gt;
            FOOBAR
        &lt;/td&gt;
        &lt;td width=73%&gt;
            BAZ
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;input type=checkbox name=t&gt;
        &lt;/td&gt;
        &lt;td width=25%&gt;
            FOO
        &lt;/td&gt;
        &lt;td width=73%&gt;
            BAR
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>And my JavaScript:</p>

<pre><code>var c = [];

c = window.document.getElementsByTagName('input');

for (var i = 0; i &lt; c.length; i++) {
    var that = c[i];
    if (that.type == 'checkbox') {
        that.onchange = function() {
            console.log(that.checked);
            if (that.checked){
                console.log(that.parentNode.nextElementSibling.firstChild.nodeValue.trim());
            }
        };
    }
}​
</code></pre>

<p><a href="http://jsfiddle.net/davidThomas/z88HH/2/" rel="nofollow">JS Fiddle demo</a>.</p>

<p>Note that it <em>seems</em> to work reliably for the second row (and logs <code>FOO</code> to the console), but in the first row the console logs only <code>false</code>. Is there an obvious mistake I'm making?</p>
