i want to find total width of "li" using jquery. how can i get text width? How can i do it?
<p>My Code is look like below.  First alert display "test li 0" and its width 1024. But 1024 width is incorrect. Actually it is around 50 px. I want the width of text "test li 0".
how can i get text width?</p>

<hr>

<pre><code>$(document).ready(function() {
var total = 0;
var i=0;

$('#menutop &gt; span&gt; li').each(function(index) {

//var tesi = jQuery("#i_"+i).css('width');
var tesi = jQuery("#i_"+i).width();
alert(tesi + ':' + $(this).text());
total = parseInt(total) + parseInt(tesi);
i=parseInt(i)+1;

});
alert(total);
});

&lt;ul id="menutop"&gt;
    &lt;span&gt;&lt;li id="i_0" style="background-color:blue;"&gt; test li 0 &lt;/li&gt;&lt;/span&gt;
    &lt;span&gt;&lt;li id="i_1" style="background-color:blue; width:150px;"&gt; test li 1 &lt;/li&gt;&lt;/span&gt;
    &lt;span&gt;&lt;li id="i_2" style="background-color:blue; width:200px;"&gt; test li 2 &lt;/li&gt;&lt;/span&gt;
&lt;/ul&gt;
</code></pre>

<hr>
