How can I use jQuery to count the number of child elements (in this case list elements) inside div id #foo and then divide 100 / (# of counted child elements). The last step would be to apply that as a percentage based width
<style="width: Npx">
Where N = [100/(# of child elements)]?
Try this(it takes care of case when there are not children in foo):