JQuery, find parent

后端 未结 7 1612
日久生厌
日久生厌 2021-01-31 02:15
$(\'#thisid\').parent(\'li\');
相关标签:
7条回答
  • 2021-01-31 03:09

    You may actually want to use $("#thisid").closest('li'). This traverses up the DOM tree from the selected node and returns the first matching ancestor whereas the .parents() travels from the parent node and returns all ancestor nodes matching that filter. See here for more information.

    0 讨论(0)
提交回复
热议问题