jQuery removeClass() 方法

jQuery 教程 · 2019-03-27 17:44:04

实例

从所有的 <p> 元素移除 "intro" 类:

$("button").click(function(){ $("p").removeClass("intro"); });

定义和用法

removeClass() 方法从被选元素移除一个或多个类。

注意:如果没有规定参数,则该方法将从被选元素中删除所有类。

语法

$(selector).removeClass(classname,function(index,currentclass))

参数 描述
classname 可选。规定要移除的一个或多个类名称。如需移除若干个类,请使用空格分隔类名称。

注意: 如果该参数为空,则将移除所有类名称。
function(index,currentclass) 可选。返回要移除的一个或多个类名称的函数。
  • index - 返回集合中元素的 index 位置。
  • currentclass - 返回被选元素的当前类名。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Algorithms of the Intelligent Web

Algorithms of the Intelligent Web

Haralambos Marmanis、Dmitry Babenko / Manning Publications / 2009-7-8 / GBP 28.99

Web 2.0 applications provide a rich user experience, but the parts you can't see are just as important-and impressive. They use powerful techniques to process information intelligently and offer featu......一起来看看 《Algorithms of the Intelligent Web》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试