In this example, I select the group “A inside” the LI (in fact, it does not matter what I choose, I just know that I am returning the group of tags “A” that have the same “attribute structure”,).
I was wondering how I would return a comma-separated list (or object / collection) from the "attribute values". I was wondering if this can be done without a loop.
alert($(".bzsUserSelector-selected A"));
// this returns "[object]", which is expected
alert($(".bzsUserSelector-selected A").length);
// this returns "4", which is expected for my example
alert($(".bzsUserSelector-selected A").attr("myAttribute"))
// this returns "aaa", which is the value of the FIRST "myAttribute" only, I don't want that.
// I want something like this "aaa, bbb, ccc, ddd"
I would like to return an object of 4 elements and only 4 values of the "myAttribute" attribute.
Hope this is clear enough. Thank you in advance. - Mark
source
share