Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery有时无法在页面加载时在IE中隐藏()_Jquery_Jquery Ui_Internet Explorer - Fatal编程技术网

jQuery有时无法在页面加载时在IE中隐藏()

jQuery有时无法在页面加载时在IE中隐藏(),jquery,jquery-ui,internet-explorer,Jquery,Jquery Ui,Internet Explorer,我想找出为什么页面加载时某些元素确实隐藏在页面加载IE中,而有时它们却不隐藏(在IE9中测试)。我正试图重现jqueryui手风琴的行为,因为它做了同样的事情/有同样的问题 在php中使用header()或甚至使用标准链接重新加载或单击重定向/重新加载时,有时hide()不起作用,有时相同的链接起作用,元素隐藏 IE显示在IE9标准中工作,因为我发现在jQ/jQui中没有正式支持怪癖,为了确保我甚至在文档头中有X-UA-Compatible“content=“IE=edge”,甚至使用php发送

我想找出为什么页面加载时某些元素确实隐藏在页面加载IE中,而有时它们却不隐藏(在IE9中测试)。我正试图重现jqueryui手风琴的行为,因为它做了同样的事情/有同样的问题

在php中使用header()或甚至使用标准链接重新加载或单击重定向/重新加载时,有时hide()不起作用,有时相同的链接起作用,元素隐藏

IE显示在IE9标准中工作,因为我发现在jQ/jQui中没有正式支持怪癖,为了确保我甚至在文档头中有X-UA-Compatible“content=“IE=edge”,甚至使用php发送相应的头

W3C验证程序文档中,验证/xhtml1转换过程无错误地通过/

相关的html标记是/简化的/

<h3><a id="tog1" href="/....">...</a></h3>
<div class="smg" id="tog1e"> .... </div>

<h3><a id="tog2" href="/....">...</a></h3>
<div class="smg" id="tog2e"> .... </div>

<h3><a id="tog3" href="/....">...</a></h3>
<div class="smg" id="tog3e"> .... </div>
我仍然不明白为什么有时候IE可以工作,有时候不行。其他浏览器(当前的Chrome和Firefox)总是可以工作

补充 我刚才提到,这可能(也可能不是)与页面上也使用了其他框架(mootools)有关。不过,正如所说的,Firefox和Chrome并不抱怨,而且总是有效的,而IE有时不会,但只是有时有效

在IE中,我发现有时控制台告诉我某些对象没有某些属性或函数(这可能是与使用两个框架相关的一点),我已经开始使用jQ的noconflict,并在脚本中用“$”替换“jQuery”,但到目前为止似乎没有帮助


我如何解决这个问题?我确实需要MooTools和jQuery。

$(“#div.smg”).hide()
是一个糟糕的选择器,至少不是你想要的,我认为。很抱歉,这是简单化时的打字错误,最初我有一个更复杂的选择器(“#wrapperid div.smg”),很抱歉,我在问题中更正了它,仍然是最重要的。”为什么有时是,有时不是?当隐藏不起作用时,控制台中出现任何错误?我在IE中遇到类似的不一致,最终使用
.css('display','block')
.css('display','none')
我自己来解决它。这些等价物可能对您有所帮助
jQuery(function() { 
// selectors are "a" (links)
$("#tog1").click( function(e){ 
 $("div.smg").hide(); $("#tog1e").show();e.preventDefault();});
$("#tog2").click( function(e){ 
 $("div.smg").hide(); $("#tog2e").show();e.preventDefault();});
$("#tog3").click( function(e){ 
 $("div.smg").hide(); $("#tog3e").show();e.preventDefault();});

if(document.location.href.indexOf('...link of tog1...') > -1 ) 
{  $("div.smg").hide(); $("#tog1e").show();}
else if ( document.location.href.indexOf('...link of tog2...') > -1 ) 
{ $("div.smg").hide(); $("#tog2e").show();}
else { $("div.smg").hide(); $("#tog3e").show();}

//.... other unrelated code follows after