I need to be able to get the width of elements from an array
HTML
- --------
You can also do something like this using nth-child:
$("#container li:nth-child(1)").width(); // first li
You can use .eq
function like below,
$array.eq(2).width()
DEMO: http://jsfiddle.net/8zvkn/2/
$array[2]
- returns DOM element but what you need is the jQuery object which has the .width
function.
Use eq :
$('#container li').eq(i)