问候
哈维
var ids = []; $('.myClass').each(function () { ids.push($(this).attr('id')); // ids.push(this.id) would work as well. });