使用jQuery获取元素的所有属性attributes

attributes
$(this).each(function() {
  $.each(this.attributes, function() {
    // this.attributes is not a plain object, but an array
    // of attribute nodes, which contain both the name and value
    if(this.specified) {
      console.log(this.name, this.value);
    }
  });
});

 

posted @ 2018-12-14 16:32  Shimily  阅读(5351)  评论(0编辑  收藏  举报