jquery get father of element

后端 未结 6 2152
攒了一身酷
攒了一身酷 2020-12-21 06:08

I\'ve got an element which resides inside a div. I\'d like to get the div by the child\'s ID, is this possible? if so how?

Thank you!

6条回答
  •  不知归路
    2020-12-21 06:47

    Using JQuery to get the child element, and standard JS to address the parent:

    element = $('#childID')[0].parentNode
    

提交回复
热议问题