jquery获取对象的全部属性

$.fn.attr = function() {

if(arguments.length === 0) {
if(this.length === 0) {
return null;
}

var obj = {};
$.each(this[0].attributes, function() {
if(this.specified) {
obj[this.name] = this.value;
}
});
return obj;
}

return old.apply(this, arguments);
};

Last modification:February 14th, 2018 at 11:42 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment