Ha. Found an answer:

http://groups.google.com/group/jquery-en/browse_thread/thread/b73ab7267d9e0357/cc4b528a4f079254?lnk=gst&q=attr+array#cc4b528a4f079254

Has anyone used this?

$.fn.attrs = function(key, val){
        if (val != undefined)
                return this.attr(key, val);
        return $.map(this, function(a){
                return $(a).attr(key);
        });
}

On Nov 20, 12:30 pm, Bill <bllfr...@gmail.com> wrote:
> Hey y'all,
>
> The jQuery attr() method returns only the attribute of a set's first
> matched element. E.g., for the HTML snippet:
>
> <input type="text" name="input-one" value="some stuff"/>
> <input type="text" name="input-two" value="some other stuff"/>
> <input type="text" name="input-three" value="some other other stuff"/>
>
> the jQuery expression
>
> $("input").attr("name") will return only the string "input-one."
>
> What if, instead, I wanted to return all the attribute values in an
> array? What's the syntax to produce this result?
>
> Thanks in advance,
>
> --Bill

Reply via email to