扫码关注官方订阅号
暂停 配置 更多操作
running为正在运行,pause为已暂停,icon和span文字通过css添加。 如何通过点击state-btn控制同一行中的.current-state的状态?
欢迎选择我的课程,让我们一起见证您的进步~~
<tr> <th class="current-state"> <i class="iconfont"></i> <span></span> </th> <th class="operation"> <button class="state-btn"></button> <button>配置</button> <button>更多操作</button> </th> </tr> $('.state-btn').click(function(){ $(this).parent('.operation').parent().toggleClass('running'); });
已经自己解决!获取点击button的父元素的父元素,添加class.running,默认状态下,icon、span文本、button文本均通过css伪类content控制,给tr增加.running,running状态下,更换icon和文本就好了!
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
已经自己解决!获取点击button的父元素的父元素,添加class.running,默认状态下,icon、span文本、button文本均通过css伪类content控制,给tr增加.running,running状态下,更换icon和文本就好了!