ul l-6ren">
gpt4 book ai didi

jquery - 知道为什么 .addClass 不适用吗? jQuery

转载 作者:行者123 更新时间:2023-12-01 06:28:42 25 4
gpt4 key购买 nike

(function (){

var stones = parseInt($('body').attr('data-site')) + 1,
theul = $(".submenu > ul li:nth-child(" + stones + ")");

console.log(theul);
$('theul').addClass('active');
console.log(theul);
})();

日志显示添加类之前和之后完全相同的内容。

enter image description here

最佳答案

你的选择器是错误的,应该是:

theul.addClass('active');

关于jquery - 知道为什么 .addClass 不适用吗? jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11351442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com