selecting root element in jquery

后端 未结 9 651
粉色の甜心
粉色の甜心 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:47

    you could look into using the parent() and children() functions. is you need to go multiple levels , you can chain them like so.

    $("#a01").parent().parent()  //returns 

    please see my comment, and I'll try to give a better solution.

提交回复
热议问题