扫码关注官方订阅号
html代码如下
零食 饮料 百货 女用 男用
零食
饮料
百货
女用
男用
js代码如下
setTimeout(function() { $(".xxls").attr('id', 'xxls'); $(".nnyl").attr('id', 'nnyl'); $(".shbh").attr('id', 'shbh'); $(".girlzone").attr('id', 'girlzone'); $(".boyzone").attr('id', 'boyzone'); }, 2000);
光阴似箭催人老,日月如移越少年。
试试jQuery .prop() 方法。
如果你的代码是全的话,里面根本不存在.xxls这个类啊。你是怎么获取的,莫非你是用href?那可以这样写
.xxls
$('a[href=xxls]').parent().attr(....)
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
试试jQuery .prop() 方法。
如果你的代码是全的话,里面根本不存在
.xxls这个类啊。你是怎么获取的,莫非你是用href?那可以这样写
$('a[href=xxls]').parent().attr(....)