get and set individual width elements
<p>Since IE7 doesnt support CSS width:auto; width:100%; or width:inherit; on span tags i need to get and set this width with jQuery.</p>

<p>So how can i set span class="center_bg" to the same width as its nearest span class="text" </p>

<p>I tried the code below, but it applys the same width on every  span class="center_bg" element on every loop thru.</p>

<pre><code>jQuery('.ul li span.menu_text').each(function(i) {
   var spanWidth = jQuery(this).width();
   jQuery("span.center_bg").width(spanWidth);
})

&lt;ul&gt;
  &lt;li&gt;
    &lt;a&gt;
      &lt;span class="left_bg"&gt;&lt;/span&gt;
      &lt;span class="right_bg"&gt;&lt;/span&gt;
      &lt;span class="center_bg"&gt;&lt;/span&gt;
      &lt;span class="text"&gt;&lt;/span&gt;
    &lt;a/&gt;
 &lt;/li&gt;
 &lt;li&gt;
   &lt;a&gt;
     &lt;span class="left_bg"&gt;&lt;/span&gt;
     &lt;span class="right_bg"&gt;&lt;/span&gt;
     &lt;span class="center_bg"&gt;&lt;/span&gt;
     &lt;span class="text"&gt;&lt;/span&gt;
   &lt;a/&gt;
 &lt;/li&gt; 
&lt;/ul
</code></pre>
