remove

英 [r??mu:v]? ?美 [r??muv]??

vt.去除;開除;脫掉,拿下;遷移

vi.遷移,移居;離開

n.距離,差距;移動(dòng)

class

英 [klɑ:s]? ?美 [kl?s]??

n.班;階級(jí);等級(jí);種類

vt.把…歸入某等級(jí),把…看作(或分類、歸類);把…編入某一班級(jí)

adj.很好的,優(yōu)秀的,出色的

vi.屬于…類(或等級(jí)),被列為某類(或某級(jí))

jquery removeClass()方法 語法

作用:removeClass() 方法從被選元素移除一個(gè)或多個(gè)類。如果沒有規(guī)定參數(shù),則該方法將從被選元素中刪除所有類。

語法:$(selector).removeClass(class)

參數(shù):

參數(shù)描述
class? ??可選。規(guī)定要移除的 class 的名稱。如需移除若干類,請(qǐng)使用空格來分隔類名。如果不設(shè)置該參數(shù),則會(huì)移除所有類。

使用函數(shù)來移除類:使用函數(shù)來刪除被選元素中的類。

語法:$(selector).removeClass(function(index,oldclass))

參數(shù):

參數(shù)描述
function(index,oldclass)?必需。通過運(yùn)行函數(shù)來移除指定的類。
index?可選。接受選擇器的 index 位置。
html?可選。接受選擇器的舊的類值。

jquery removeClass()方法 示例

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("p").removeClass("intro");
  });
});
</script>
<style type="text/css">
.intro
{
font-size:120%;
color:red;
}
</style>
</head>

<body>
<h1 id="h1">This is a heading</h1>
<p class="intro">This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>從第一個(gè)段落中刪除類</button>
</body>
</html>
運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例