2016-06-29 21 views
0

このコードを使用していて、正しいオブジェクトを出力していますが、これらのオブジェクトからIDだけを取得できません。ここでは、コードは次のとおりjqueryを使用して兄弟の子供のIDを取得するには

console.log($(this).parent().parent().siblings().children()); 

出力は:

[DIV#最初example.box-prop.topウィジェット、DIV#二example.box-prop.topウィジェット、DIV#サードexample.box-prop.topウィジェット、prevObject:[3]、コンテキストINIT:i.fa.fa-times.close-X]

答えて

1

あなたが.mapを使用することができます。

var ids = $(this).parent().parent().siblings().children().map(function(e){ 
    return this.id; 
}).get(); 
関連する問題