gpt4 book ai didi

javascript - jquery :nth-child() class is not working

转载 作者:行者123 更新时间:2023-12-01 02:30:30 24 4
gpt4 key购买 nike

这不起作用

$(".text_read:nth-child(2)").css("background", "transparent url('images/text_read2.png') no-repeat");

以上代码的结果与以下代码相同

$(".text_read").css("background", "transparent url('images/text_read2.png') no-repeat");

我的 HTML 代码是

<div class="welcome">
<p class="welcometext">MORE UPCOMING NEWS FOR INTERNATIONAL EVENTS</p>
<div class="all_international_img row-fluid">
<div class="welcome-image span4 international_img">
<img src="images/img1.png">
<div class="text_read">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a </div>
</div><!--all_international_img row-fluid-->
<div class="welcome-image span4 international_img">
<img src="images/img1.png">
<div class="text_read">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a </div>
</div><!--all_international_img row-fluid-->
<div class="welcome-image span4 international_img">
<img src="images/img1.png">
<div class="text_read">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a </div>
</div><!--all_international_img row-fluid-->
</div><!--all_international_img-->
</div><!--welcome-->

最佳答案

看起来您想使用 .eq()相反

$('.text_read:eq(2)')

DEMO

关于javascript - jquery :nth-child() class is not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18759298/

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