jQuery addClass() 方法
jQuery 教程
· 2019-03-27 10:57:36
实例
向第一个 <p> 元素添加一个类名:
$("button").click(function(){
$("p:first").addClass("intro");
});
定义和用法
addClass() 方法向被选元素添加一个或多个类名。
该方法不会移除已存在的 class 属性,仅仅添加一个或多个类名到 class 属性。
提示:如需添加多个类,请使用空格分隔类名。
语法
$(selector).addClass(classname,function(index,oldclass))
| 参数 | 描述 |
|---|---|
| classname | 必需。规定一个或多个要添加的类名称。 |
| function(index,currentclass) | 可选。规定返回一个或多个待添加类名的函数。
|
点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html
Web 2.0 Heroes
Bradley L. Jones / Wiley / 2008-04-14 / USD 24.99
Web 2.0 may be an elusive concept, but one thing is certain: using the Web as merely a means of retrieving and displaying information is history. Today?s Web is immediate, interactive, innovative. It ......一起来看看 《Web 2.0 Heroes》 这本书的介绍吧!