hasClass() removeClass() addClass()
//检查第元素是否包含 "intro" 类
$("button").click(function(){
alert($("p:first").hasClass("intro"));
});
向第一个 p 元素添加一个类:
$("button").click(function(){
$("p:first").addClass("intro");
});
移除所有 <p> 的 "intro" 类:
$("button").click(function(){
$("p:first").removeClass("intro");
});
浙公网安备 33010602011771号