Skip to content

Instantly share code, notes, and snippets.

@h2rd
Created December 8, 2011 11:05
Show Gist options
  • Save h2rd/1446724 to your computer and use it in GitHub Desktop.
Save h2rd/1446724 to your computer and use it in GitHub Desktop.
$.fn.getAttributes = function() {
var attributes = {};
if(this.length === 0) {
return attributes;
}
$.each(this[0].attributesttributes, function(index, attr) {
attributes[attr.name] = attr.value;
});
return attributes;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment