gpt4 book ai didi

jquery - 简单的 jquery $(this).next() 在 IE 中不起作用

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

我有这个标记

<h2>Title</h2>
<div class="info-content">
<p>some code in here too</p>
</div>

还有这个 jquery

(function($) { 
$(".info-content").hide();
$("h2").click(function(){
$(this).next().slideToggle("normal");
});
})(jQuery);

在除 IE6+ 之外的任何浏览器中,它可以切换 .info-content 的打开和关闭。

有什么想法为什么这在 IE 中不起作用吗?我假设它非常简单,但我已经尝试弄清楚它有一段时间了。

任何帮助都会很棒,

谢谢。

最佳答案

next() 可能会返回一个文本节点。

尝试$(this).nextAll("p:first")

关于jquery - 简单的 jquery $(this).next() 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6585104/

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