That's just not what it does. Getter methods like that generally return the value for the first matched element. If you want a plugin to return all the values in an array you can write it like this (untested):
jQuery.fn.attrs = function(key,val) { if (val != undefined) return this.each(function() { $(this).attr(key,val); }); var a = []; this.each(function() { a.push($(this).attr(key)); }); return a; }; And then call it like this: var arr = $('div').attrs("id"); Mike On 4/30/07, Ariel Jakobovits <[EMAIL PROTECTED]> wrote:
I am looking for an explanation as to why .attr('id') executed on an array of jQuery elements does not return an array of ids.