title: jQuery: Retrieve named attribute from multiple elements
body: <p>I have a bunch of elements that I wish to convert to an array of attributes and I'm using the following code:</p>
  
  <pre><code>var attributes = [];
  $("#id").find("tag").each(function() {
      attributes.push($(this).attr("attribute"));
  });
  </code></pre>
  
  <p>Is there a neater way to do this? Feels like I'm using shears to trim my finger nails.</p>
  
  <p>I've been using <code>d3</code> recently, it feels like there could be a way to do this in a way that would look like <code>var attributes = $("#id").find("tag").attr("attribute");</code> but this just sets the variable to the attribute of the first element in the selection.</p>