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

One comment

  1. 伍子蛇

    没找到你留言板,有个小建议,不要劫持滚动条,mac上用着不能停在想停的位置好难受

Leave a Comment