简体   繁体   English

jQuery 不能在 IE11 上运行,但可以在 Chrome、Firefox 和 Edge 上运行?

[英]jQuery not working on IE11 but working on Chrome, Firefox and Edge?

My scripts are working fine on all other browsers EXCEPT IE11.我的脚本在除 IE11 之外的所有其他浏览器上运行良好。 For example例如

jQuery('#btnblacklist').click(function(){
    jQuery('#popUpBlackList').css("display","block");
    jQuery('.cover').css('display','block');
});

is not returning anything on IE11.在 IE11 上没有返回任何内容。 Even Microsoft Edge is okay with it.甚至 Microsoft Edge 也可以。

I have already called the script in my header.我已经在我的标题中调用了脚本。

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>

Any idea?任何想法?

Try this solution, you need to wrap our code in a .ready function.试试这个解决方案,你需要将我们的代码包装在一个 .ready 函数中。

$(document).ready(function () {
    jQuery('#btnblacklist').click(function () {
        jQuery('#popUpBlackList').css("display", "block");
        jQuery('.cover').css('display', 'block');
    });
});

So you're code will start to run when the document is finished loading.因此,您的代码将在文档完成加载后开始运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM