Map ID of Element

Maps the IDs of any element of choice.

by japaneselanguagefriend

HTML

<div class="cookie" id="one" />
<div class="cookie" id="two" />
<div class="cookie" id="three" />

<div id="output"></div>

JavaScript

var ids = $('.cookie').map(function(i) {
    return this.id;
});

$('#output').text(ids.get().join(', '));