After selecting $(".myclass") you can use the .map() [ docs ] method to take the .id each element. This will return a jQuery array object containing identifiers.
var ids = $(".myclass").map(function() { return this.id; });
Add .toArray() [ docs ] to the end if you need a real array.
source share