当前位置:网站首页>DOM系列之classList属性
DOM系列之classList属性
2022-08-01 15:55:00 【老__L】
classList 属性是 HTML5 新增的一个属性,返回元素的类名。但是 ie10 以上版本支持。该属性用于在元素中添加,移除及切换 CSS 类。有以下方法:
1、添加类
1.1、语法
element.classList.add("类名");
1.2、示例
focus.classList.add("current");
2、移除类
2.1、语法
element.classList.remove("类名");
2.2、示例
focus.classList.remove("current");
3、切换类
3.1、语法
element.classList.toggle("类名");
3.2、示例
focus.classList.toggle("current");
注意以上方法里面,所有类名都不带点
后记
如果你感觉文章不咋地
//(ㄒoㄒ)//,就在评论处留言,作者继续改进;o_O???
如果你觉得该文章有一点点用处,可以给作者点个赞;\\*^o^*//
如果你想要和作者一起进步,可以微信扫描二维码,关注前端老L;~~~///(^v^)\\\~~~
谢谢各位读者们啦(^_^)∠※!!!

边栏推荐
- 27英寸横置大屏+实体按键,全新探险者才是安全而合理的做法!
- 请问nacos 连接mysql失败后会重新连接吗?
- 在网站页脚增加几只戏水的小鱼
- Why should model.eval() be added to the pytorch test?
- HDU 2602: Bone Collector ← 0-1背包问题
- 兆骑科创平台招才引智,海内外高层次人才引进平台
- LeetCode50天刷题计划(Day 11—— 最接近的三数之和(8.40-10.00)
- js邯郸市地图网页源码下载
- 未来小间距竞争的着力点在哪里
- 【论文笔记】MiniSeg: An Extremely Minimum Network for Efficient COVID-19 Segmentation
猜你喜欢

设计专业第一台笔记本 华硕灵耀Pro16 2022 新品首发超值入手

js邯郸市地图网页源码下载

游戏元宇宙发展趋势展望分析

【论文笔记】MiniSeg: An Extremely Minimum Network for Efficient COVID-19 Segmentation

shell 基础之函数编写

MySQL中的存储过程(详细篇)

美国弗吉尼亚大学、微软 | Active Data Pattern Extraction Attacks on Generative Language Models(对生成语言模型的主动数据模式提取攻击)
![MySQL [create and manage tables]](/img/5f/fc5d278f32df859e2c454b6d8467ed.png)
MySQL [create and manage tables]

2.8K 120Hz touch dual-screen blessing Lingyao X dual-screen Pro 2022 makes the office without fear of imagination

主流定时任务解决方案全横评
随机推荐
分布式数据库难题(一):数据分区
js邯郸市地图网页源码下载
SQL查询数据以及排序
String comparison size in MySQL (date string comparison problem)
到底什么才是真正的商业智能(BI)
Why should model.eval() be added to the pytorch test?
kubelet node pressure eviction
Arduino无线下载 Arduino USB接口无线自动下载程序
pynlpir更新license Error: unable to fetch newest license解决方案
Next-ViT学习笔记
A full review of mainstream timed task solutions
p5js炫酷网页流光动画
IronOS, an open source system for portable soldering irons, supports a variety of portable DC, QC, PD powered soldering irons, and supports all standard functions of smart soldering irons
预定义和自定义
【论文笔记】MiniSeg: An Extremely Minimum Network for Efficient COVID-19 Segmentation
MySQL中根据日期进行范围查询
2.8K 120Hz touch dual-screen blessing Lingyao X dual-screen Pro 2022 makes the office without fear of imagination
Pytorch - Distributed Model Training
2022-08-01 Daily: 18 graphs to intuitively understand neural networks, manifolds and topology
五分钟带你上手ShardingJDBC实现MySQL分库分表