I am wok开发者_开发技巧ring on a dialog, where in execution I want to round up all items that have a specific attribute and place an attribute value of their's into a comma delited list.
This is as far as I have gotten, which isnt far.
buttons: {
'Hook': function(){ $('.grid_pic:has(border=3)').(loop through id's, grab src, build variable with srcs comma delimeited)
}
Any ideas?
var srcs = new Array();
$('.grid_pic[border=3]').each(function() {
srcs[srcs.length] = $(this).attr('src');
});
var result = srcs.join(',');
This is a concise approach to getting it:
var commalist = $('.grid_pic:has(border=3)').map(function() {
return $(this).attr('src');
}).get().join(',');
精彩评论