无为清净楼资源网 Design By www.qnjia.com
addClass(class)
为每个匹配的元素添加指定的类名。 Adds the specified class(es) to each of the set of matched elements.返回值
jQuery
参数
class (String) : 一个或多个要添加到元素中的CSS类名,请用空格分开
示例
为匹配的元素加上 'selected' 类
HTML 代码:
<p>Hello</p>jQuery 代码:
$("p").addClass("selected");结果:
[ <p class="selected">Hello</p> ]为匹配的元素加上 selected highlight 类
HTML 代码:
<p>Hello</p>jQuery 代码:
$("p").addClass("selected highlight");结果:
[ <p class="selected highlight">Hello</p> ] ------------------------------------------------------------------------------------------------------------------------------removeClass(class)
从所有匹配的元素中删除全部或者指定的类。 Removes all or the specified class(es) from the set of matched elements.返回值
jQuery
参数
class (String) : (可选) 一个或多个要删除的CSS类名,请用空格分开
示例
从匹配的元素中删除 'selected' 类
HTML 代码:
<p class="selected first">Hello</p>jQuery 代码:
$("p").removeClass("selected");结果:
[ <p>Hello</p> ]删除匹配元素的所有类
HTML 代码:
<p class="selected first">Hello</p>jQuery 代码:
$("p").removeClass();结果:
[ <p>Hello</p> ] ------------------------------------------------------------------------------------------------------------------------------toggleClass(class)
如果存在(不存在)就删除(添加)一个类。 Adds the specified class if it is not present, removes the specified class if it is present.返回值
jQuery
参数
class (String) :CSS类名
示例
为匹配的元素切换 'selected' 类
HTML 代码:
<p>Hello</p><p class="selected">Hello Again</p>jQuery 代码:
$("p").toggleClass("selected");结果:
[ <p class="selected">Hello</p>, <p>Hello Again</p> ]
标签:
属性
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年10月09日
2024年10月09日
- s14全球总决赛瑞士轮赛制是什么 全球总决赛瑞士轮赛制详情
- 《COD21》全新剧情宣传片:10月25日XGP见!
- 美国拳王家门口身中7枪遇害 年仅31岁凶手仍未被逮捕
- 《寂静岭2》重制版光追对比:氛围更加恐怖
- 林慧萍.1982-往昔(飞跃复刻版)【歌林】【WAV+CUE】
- 陈楚生.2007-原来我一直都不孤单(EP)【天娱传媒】【WAV+CUE】
- 罗嘉良.1986-秦始皇(2014环球复黑王·百代篇)【EMI百代】【WAV+CUE】
- 2024周年庆赠送物品介绍,周年庆送什么
- 【原神】V5.0攻略 |「明黄曜石断片」全收集
- 【原神】V5.0攻略 | 隐藏成就「烦请高抬贵脚」达成
- 证声音乐图书馆《蔚蓝海岸·爵士度假日》[FLAC/分轨][155.47MB]
- 腾讯音乐人《浪漫火焰(新势力计划合辑 Vol.11)》[320K/MP3][56.91MB]
- 腾讯音乐人《浪漫火焰(新势力计划合辑 Vol.11)[FLAC/分轨][147.45MB]
- 2024年,哪里还可以玩有趣的魔兽RPG?
- 类银河恶魔城动作游戏《灵魂熔解》已正式登陆Steam