jQuery hide() not working (IE9)
jQuery hide() not working (IE9)
我正在制作一个div,它应该在页面加载时隐藏,然后在用户单击链接后可见。下面的代码适用于FF/IE7/IE8,但不适用于IE9,因为在IE9中div始终可见(没有内容)。提前感谢!
<script>
$(document).ready(function() {
$('#translateBoxen').hide();
$('#translateToggle').click(function() {
$('#translateBoxen').toggle(400);
return false;
});
});
</script> // This is the jQuery code to hide and toggle the div //
<div style="width:200px;height:100px;position:absolute;"> // Just a holder that's needed for the site
<a class="vitxtext" style="font-size:10px;" id="translateToggle" href="#">
Translate
</a>
<div style="clear:both;"></div>
<div id="translateBoxen">
// BOX CONTENT //
</div>
</div>
为什么不用CSS隐藏<div>
?只要在CSS中设置为display:none
,那么当第一次单击切换链接时,它就会显示出来。
toggle()
没有理由不在IE9中工作,你有任何脚本错误吗?
派对迟到了,但试着用display:none
制作一个.hidden
类,然后通过放置addClass('hidden')
和removeClass('hidden')
来隐藏/显示,而不是显示/隐藏。
相关文章:
- Angular JS IE9 Hashbang url rewriting
- 在Twitter上用ie9中的空白src访问iframe的contentWindow
- $rootScope not working
- 在IE9中的输入字段中输入焦点最近按钮
- jQuery document.ready not working
- 为什么jQuery 1.8不能在IE8和InternetExplorer9中使用?(截至2012年9月的IE9最新版本)
- Javascript getElementsByTagName not working?
- IE9的HTML5 Canvas getImageData()函数存在问题
- 使用JavaScript在IE9中获取数据列表选项
- JQuery.val( ) not working
- Ajax模式下的Jquery Select2 V4在IE9中不起作用
- Tomcat websocket is not working
- Javascript JSON.parse not working
- NodeJS Multer is not working
- jQuery无法在IE9中隐藏选项
- Regex not working
- Ember run.debounce not working
- AngularJs 1 not working
- jQuery hide() not working (IE9)
- Soundcloud JS SDK is not working with IE9