jQuery .next()不起作用? [英] jQuery .next() doesn't work?
本文介绍了jQuery .next()不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将jQuery .next()
与选择器一起使用,似乎我错过了一些东西
I am trying to use jQuery .next()
with a selector, seems that I missed something.
我的代码:
<div>1</div>
<span>2</span>
<div class="dd">3</div>
<div>4</div>
$('div').next(".dd").css('color','red');
如果我将跨度更改为div,则可以使用,但是这种方法不起作用!
If I change the span to div it works, but this way doesn't!
有帮助吗?
推荐答案
我应该使用 nextAll()不是下一个
$('div').nextAll(".dd").css('color','red');
这篇关于jQuery .next()不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文