Need to set the width of a parent div dynamically based on the width of a ul
<p>I've got a subnav on my site which is horizontal and I need to center it in the layout. Every subnav has a differnt number of elements so I need to calculate the width of the UL and then add it to the wrapping div so it will center properly.</p>

<p>Here is my html</p>

<pre><code>&lt;div id="subNav"&gt;
&lt;ul id="navsub_761243_795431"&gt;
&lt;li&gt;&lt;a href="/Asset/RIA"&gt;Why Choose a RIA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/Asset/HowWeOperate"&gt;How We Operate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/Asset/ethicalinvesting"&gt;Ethical Investing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/Asset/IndependentCustodian.htm"&gt;Independent Custodian&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/Quest/home"&gt;Insure Quest&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>Sometimes the above list will be 2 elements, sometimes 1, sometimes 6.</p>

<p>Here is the jQuery I was messing with. It sits within a document ready function.</p>

<pre><code>$("#subNav").css("width", $("#subNav ul").children("li").innerWidth());
</code></pre>

<p>This will give me the width of one element, not the sum of all of them. Any help is greatly appreciated!.</p>
