jQuery: How to count table columns?
<p>Using jQuery, how would you figure out how many columns are in a table?</p>

<pre><code>&lt;script&gt;
    alert($('table').columnCount());
&lt;/script&gt;

&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;spans one column&lt;/td&gt;
        &lt;td colspan="2"&gt;spans two columns&lt;/td&gt;
        &lt;td colspan="3"&gt;spans three columns&lt;/td&gt;
    &lt;tr&gt;
&lt;/table&gt;
</code></pre>

<p>The total number of columns in this example is 6. How could I determine this using jQuery?</p>
