var contents = $.map($('.text'), function(el){return $(el).text()}); var a = contents.join(',');
var contents = []; $('a').map(function(i){ contents[i] = $(this).text() }); var a = contents.join(',');