jquery 清除嵌入式样式

1 /*有些页面样式不规范,没有写在一个class里,例如:<div id="show" style="width:100px; padding-top:10px; font-size:12px;"></div>
2 */
3 
4 //这种情况下清空style可以removeAttr()方法移除style属性来实现
5 
6 $("#show").removeAttr("style"); //ie,ff均支持
7  
8 $("#show").attr("style","");   //ff支持,ie不支持 

 

posted on 2015-08-05 22:05  吹散的云  阅读(300)  评论(0编辑  收藏  举报