Skip to content

Instantly share code, notes, and snippets.

@uhhuhyeah
Created October 22, 2012 04:56
Show Gist options
  • Save uhhuhyeah/3929709 to your computer and use it in GitHub Desktop.
Save uhhuhyeah/3929709 to your computer and use it in GitHub Desktop.
grab the ids (or other attribute) from a set of DOM elements
// grab the ids (or other attribute) from a set of DOM elements
var ids = $("#mydiv span[id]") // find spans with ID attribute
.map(function() { return this.id; }) // convert to set of IDs
.get(); // convert to instance of Array (optional)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment