Question: I have a div with a bunch of images inside floated left. I want to get the collective width of all the images. I know I can just grab the width of the div since it expands to fit it's contents but how can I do it the other way, by calculating the inner content's width?

EDIT
----

Sorry here's the markup:

```
   <div id="gallery">

        <ul>
           <li><img src="images/a.png" /></li>
           <li><img src="images/b.png" /></li>
           <li><img src="images/c.png" /></li>
        </ul>

    </div>

```

I need to get the width of all the lis combined.

Answer: 
Try this

```
var totalWidth = 0;
$('#gallery li').each(function(){
    totalWidth  += $(this).outerWidth(true);
});

```

`totalWidth` will give you the combined `width` of all the li's inside the `div#gallery`
You can try something like this:

```
    var sumWidth = 0;
    $('selector').each(function(){
        var sumWidth += $(this).width();
    });
    alert('the width sum is: '+sumWidth);

```

Hope it helps!