在这个例子中,我选择了一堆'A'在'LI'中(我选择的并不重要,只知道我正在返回一组'A'标签,这些标签都具有相同的"属性结构").
我想知道如何返回"属性值"的逗号分隔列表(或对象/集合).我想知道是否可以在没有循环的情况下完成.
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"
Run Code Online (Sandbox Code Playgroud)
我希望返回一个4项的对象,只返回"myAttribute"属性的4个值.
我希望这很清楚.提前致谢. - 马克