HTML:
7条回答 灰色年华 (楼主) 2021-01-14 09:59 var p = $('.del').parents('li'); console.log(p); http://jsfiddle.net/hZY8R/ The .parents() and .parent() methods are similar, except that the latter only travels a single level up the DOM tree. As you can see, when you use parents with a selector, you will be fine. 0 讨论(0) 查看其它7个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
var p = $('.del').parents('li'); console.log(p);
http://jsfiddle.net/hZY8R/
The .parents() and .parent() methods are similar, except that the latter only travels a single level up the DOM tree.
As you can see, when you use parents with a selector, you will be fine.