How can I get all attributes (e.g. href) of all elements matching a jQuery selector?
href
Something like this perhaps?
var ids = []; $('.myClass').each(function () { ids.push($(this).attr('id')); // ids.push(this.id) would work as well. });