Selecting only first-level elements in jquery

前端 未结 10 2224
忘了有多久
忘了有多久 2020-11-28 03:14

How can I select the link elements of only the parent

    from a list like this?

    • Link
10条回答
  •  不知归路
    2020-11-28 04:11

    1

     $("ul.rootlist > target-element")
    2   $("ul.rootlist").find(target-element).eq(0) (only one instance)
    3   $("ul.rootlist").children(target-element)
    

    there are probably many other ways

提交回复
热议问题