gpt4 book ai didi

jquery - IE 不支持 jQuery .show()

转载 作者:行者123 更新时间:2023-12-01 03:56:52 25 4
gpt4 key购买 nike

我构建了一些简单的选项卡,单击这些选项卡时,会显示一个隐藏的 div。很简单。除了 IE 之外,一切都运行良好。由于某种原因,即使我使用 jQuery .show() 函数,它也不会将隐藏的 div 设置为 display:block,而只是将其隐藏,这非常令人沮丧。

示例页面:http://www.puc.edu/alumni/give-puc

用于选项卡的 jQuery:

$('#teamTabs li').click(function() {
$('#teamTabs li').removeClass('selected');
$(this).addClass('selected');
$('.teamTab').hide();
var id = $(this).attr('id');
if (id == 'teamTab1') {
$('#team1').show();
} else if (id == 'teamTab2') {
$('#team2').show();
} else if (id == 'teamTab3') {
$('#team3').show();
} else if (id == 'teamTab4') {
$('#team4').show();
}//end else if

return false;

});//end click

有什么想法为什么 IE 不会将 div 设置为 display:block 吗?

最佳答案

我意识到您已经发现问题出在其他地方,但对于其他人稍后发现这个问题(并将其从无答案列表中删除),您可以大大减少/简化您的代码:

$('#teamTabs li').click(function() {
$(this).addClass('selected').siblings().removeClass('selected');
$('.teamTab').hide();
$('#team'+ this.id.replace('teamTab','')).show();
return false;
});

关于jquery - IE 不支持 jQuery .show(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1440469/

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