Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.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
Javascript 小型jQuery脚本在IE8中不起作用_Javascript_Jquery_Internet Explorer - Fatal编程技术网

Javascript 小型jQuery脚本在IE8中不起作用

Javascript 小型jQuery脚本在IE8中不起作用,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,我为一个电子商务网站写了一个小脚本,如果不满足某些条件,就会出错。现在,我正在尝试编写一些东西,以便“继续”按钮将用户返回到他们的购物车。我无法更改按钮以添加类 问题是这个脚本在IE中不起作用。我不太熟悉浏览器处理JavaScript的不同之处。有人有什么想法吗 <script type="text/javascript"> jQuery("#shipping-method-buttons-container .button").wrap(fu

我为一个电子商务网站写了一个小脚本,如果不满足某些条件,就会出错。现在,我正在尝试编写一些东西,以便“继续”按钮将用户返回到他们的购物车。我无法更改按钮以添加类

问题是这个脚本在IE中不起作用。我不太熟悉浏览器处理JavaScript的不同之处。有人有什么想法吗

        <script type="text/javascript">
            jQuery("#shipping-method-buttons-container .button").wrap(function() {
               var link = jQuery('<a/>');
                link.attr('href', 'http://mywebsite.com/checkout/cart/');
               return link;
            });
        </script>

jQuery(“#shipping method buttons container.button”).wrap(函数(){
var link=jQuery(“”);
link.attr('href','http://mywebsite.com/checkout/cart/');
返回链接;
});
更新:我已经在IE9和IE10中对此进行了测试。我在所有IE浏览器中都遇到了这个问题

您可以尝试以下方法:

 $("#shipping-method-buttons-container .button").click(function(){
     window.location = "http://mywebsite.com/checkout/cart/"
})

这是在IE和其他方面的工作

jQuery(function(){
    jQuery("#shipping-method-buttons-container .button").wrap(function() {
        var link = jQuery('<a></a>').attr('href', 'http://mywebsite.com/checkout/cart/');
        return link;
    });
});
jQuery(函数(){
jQuery(“#shipping method buttons container.button”).wrap(函数(){

var link=jQuery(“

这在Magento(我正在使用的软件)之外的其他浏览器中对我有效,但不在内部。出于某种原因,它在Chrome中仍然有效,但在我的应用程序中不起作用。好的,很高兴你解决了这个问题。