Skip to content

Instantly share code, notes, and snippets.

@btjake
Created January 24, 2014 20:27
Show Gist options
  • Save btjake/8605664 to your computer and use it in GitHub Desktop.
Save btjake/8605664 to your computer and use it in GitHub Desktop.
Get a list of all attributes for a given selector
(function($, selector)
{
var coll = {};
$(selector).map(function(ei, ev) {
if(typeof ev.attributes != "undefined") {
$.map(ev.attributes, function(av, ai) {
if(!coll[av.name]) coll[av.name] = true;
});
}
});
return $.map(coll, function (value, key) { return key; });
}
)(window.jQuery, "a")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment