selecting root element in jquery

后端 未结 9 781
粉色の甜心
粉色の甜心 2021-01-18 04:06

I need to be able to select the root element from a fragment without knowing the node types, class, id or hierachy.

9条回答
  •  难免孤独
    2021-01-18 04:34

    I'm more of a Prototype guy, but I think you could get all the nodes then get the first node in the array:

    $('*')[0]
    

    Then get the child items of that (for 0a, 0b and 0c)

    $('*')[0].children()
    

提交回复
热议问题