I am collecting the text from several elements like this:-
$(\'#element\').find(\'p\').text();
However this returns the text of all the \'p
You are right about using .map along with .join.
.map
.join
Try something like this:
var names = $('#element').find('p').map(function(){ return $(this).text(); }).get().join(','); console.log(names); //The Beatles,Radiohead,Britney Spears