jQuery - Access elements in array

前端 未结 3 1253
借酒劲吻你
借酒劲吻你 2021-01-05 07:24

I need to be able to get the width of elements from an array

HTML

  • --------
3条回答
  •  离开以前
    2021-01-05 07:52

    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.

提交回复
热议问题