I have some basic markup:
<div id="container">
<div class=".content"></div>
<div class=".content"></div>
<div class=".content"></div>
<div class=".content"></div>
<div class=".content"></div>
<div class=".content"></div>
</div>
and the following jQuery code:
var listWidth = [];
$('.content').each(function(){
listWidth.push($(this).width());
console.log(listWidth);
});
This returns:
[200, 540, 200, 540, 200, 540]
How do I set the width of the parent element to the sum of the values within the array, so in this case 2220?
Many thanks in advance.