jQuery : eq() vs get()

前端 未结 8 1221
挽巷
挽巷 2020-11-28 03:50

I\'m new to jQuery, and I\'m wondering what the difference is between jQuery\'s get() and eq() functions. I may misunderstand what the get()

8条回答
  •  爱一瞬间的悲伤
    2020-11-28 04:22

    get(0)(docs) returns the first DOM element in the set.

    eq(0)(docs) returns the first DOM element in the set, wrapped in a jQuery object.

    That's why .fadeIn("slow"); doesn't work when you do .get(0). A DOM element doesn't have a fadeIn() method, but a jQuery object does.

提交回复
热议问题