-

xiyueta().removeAttr() 属性方法

从匹配元素集中的每个元素中删除一个属性
快速上手

xiyueta().removeAttr()属性方法,两种调用方式:
1、xiyueta("div").removeAttr("id"); //从匹配元素集中的每个元素中删除一个属性
2、xiyueta("div").removeAttr("id class name"); //从匹配元素集中的每个元素中删除多个属性

总结:xiyueta().removeAttr()用法与jQuery中jQuery().removeAttr()用法保持一致
see https://api.jquery.com/removeAttr
尝试一下>>

  • 代码
  • 效果
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script>
<script>var html='<div><img src="1.jpg"></div>';
xiyueta().parse(html); 
console.log( xiyueta("img").removeAttr("src").htmlwrap() );
</script>
<img>