小编ngh*_*pit的帖子

如何使用jQuery从元素中删除所有样式?

body{
    font-family: Arial;
}
div{
    color: red;
    margin: 20px;
    background: blue;
    font-size: 17px;
}
Run Code Online (Sandbox Code Playgroud)
<div id="div1">this should be styled with a blue background, 
               red text, and 17px Arial font</div>

<div id="div2">this should have no background, default font, etc. </div>
Run Code Online (Sandbox Code Playgroud)

如何#div2使用jQuery 删除所有样式和所有继承的样式?

仅删除所有样式#div2,保留样式#div1

html css jquery

-3
推荐指数
1
解决办法
2611
查看次数

标签 统计

css ×1

html ×1

jquery ×1