![](/img/trans.png)
[英]Hide siblings and parent's siblings until the given id using JQuery
[英]How do I get the id's of children of siblings using jquery
我正在使用此代码,并且它输出正确的对象,但是我无法仅从这些对象中获取ID。 这是代码:
console.log($(this).parent().parent().siblings().children());
输出为:
[div#first-example.box-prop.top-widget,div#second-example.box-prop.top-widget,div#third-example.box-prop.top-widget,prevObject:init [3],上下文:i.fa.fa-times.close-x]
您可以使用.map
:
var ids = $(this).parent().parent().siblings().children().map(function(e){
return this.id;
}).get();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.