I have a div (#container) possess a number of contents in children
divs (.content). '.content' is styled as: {display:inline;
float:left;}
How can I get the collective width of all those '.content'

I tried the followng
var contents = $("#container > .content");//It is fine and returns
array of divs
var size = 0;
var i = 0;
for(i=0;i<contents.length;i++){
     size +=contents[i].css("width");
     //OR other way
     size += contents[i].style.width;
}

but no result

however $("#container > .content").css("width") returns the width of
first child div only.

Is there is any way to traverse all the children divs for their
widths?

Shoaib Nawaz

Reply via email to