jquery get father of element

后端 未结 6 2135
攒了一身酷
攒了一身酷 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:32

    Use jQuery to get the child element, and jQuery to address the parent

    element = $('#childID').parent();
    

    Note: Yes, this is similar to Pekka's answer. It was meant to be humorous in that regard. If you don't find it humorous.....

提交回复
热议问题