Jquery清除style样式

有些页面样式不规范,没有写在一个class里,例如:<div id="show" style="width:100px; padding-top:10px; font-size:12px;"></div>

这种情况下清空style可以removeAttr()方法移除style属性来实现

$("#show").removeAttr("style"); //ie,ff均支持

$("#show").attr("style","");   //ff支持,ie不支持 

 

附:http://www.w3school.com.cn/jquery/attributes_removeattr.asp  Jquery removeAttr()方法

posted @ 2011-11-29 17:36  人来人往  阅读(149701)  评论(0编辑  收藏  举报