I’m looking to do this with one line of code.
var a = '';
$('#MyDivs div').each(function (){a+=this.id+',';});
a = a.substring(0,a.length-1);// remove the last comma
I though something like this would do it, but to no avail. Am I on the right tracks??
$('#MyDivs div[id]').join(', ');
Here you go in one line:
Here’s the fiddle: http://jsfiddle.net/tGFeZ/