Skip to content

Instantly share code, notes, and snippets.

@tejastank
Created August 19, 2012 20:23
Show Gist options
  • Save tejastank/3397454 to your computer and use it in GitHub Desktop.
Save tejastank/3397454 to your computer and use it in GitHub Desktop.
JQuery getAttributes() plugin/Feature Implementation.
/// Tejas Tank.
/// [email protected]
(function($) {
$.fn.getAttributes = function() {
var attributes = {};
if(!this.length)
return this;
$.each(this[0].attributes, function(index, attr) {
attributes[attr.name] = attr.value;
});
return attributes;
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment