如何使用jquery为div添加'class'。 这是实际的div。
<div class="swiper-container swiper-nav">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="assets/Images/Accessories/Ties/Knitted/LudlowDotKnittedTie.jpg"></div>
</div>
</div>
我需要将“active-nav”类附加到“swiper-slide”div
结果如下:
<div class="swiper-slide active-nav"><img src="assets/Images/Accessories/Ties/Knitted/LudlowDotKnittedTie.jpg"></div>
答案 0 :(得分:0)
怎么样
$(".swiper-slide").addClass ("active-nav");
答案 1 :(得分:0)
$('.thisclick').click(function(){
$('.swiper-slide').addClass('active-nav');
});