简体   繁体   English

jQuery click函数上的TypeError

[英]TypeError on jQuery click function

since any wordpress- or plugin-update one of my order-buttons dosen't work anymore. 因为任何wordpress或plugin-update都无法再使用我的订单按钮之一。

Just in safari... Chrome & Firefox is still Ok. 只是在野生动物园中... Chrome和Firefox仍然可以。

I get this error: 我收到此错误:

TypeError: Can only call HTMLElement.insertAdjacentElement on instances of HTMLElement

insertAdjacentElement - jquery.js:2958

This is the affected function: 这是受影响的功能:

$("#order-now").click(function(){

    var countEle = halsband[2].length;
    if (halsband[3] != "keins"){
        countEle++;
    }
    if (countEle == 7){
        $("#max-anzahl").css("display", "block");
        $(".modal-ov").css("display", "block");
    }else{
        letsOrder();
    }
});

The error just appears when the function "letsOrder" is called: 该错误仅在调用“ letsOrder”函数时出现:

function letsOrder(){
    jQuery.ajax({
        url: "<?php echo admin_url('admin-ajax.php'); ?>",
        data: {
            'action': 'products_to_cart',
            'halsband_id': halsband_id,
            'halsband_var_id': halsband_var_id,
            'halsband_var_name': halsband_var_name,
            'name': halsband[2],
            'buchstabe_id': buchstabe_id,
            'buchstabe_eins_var_id': buchstabe_eins_var_id,
            'buchstabe_eins_var_name': buchstabe_eins_var_name,
            'buchstabe_zwei_var_id': buchstabe_zwei_var_id,
            'buchstabe_zwei_var_name': buchstabe_zwei_var_name,
            'buchstabe_drei_var_id': buchstabe_drei_var_id,
            'buchstabe_drei_var_name': buchstabe_drei_var_name,
            'buchstabe_vier_var_id': buchstabe_vier_var_id,
            'buchstabe_vier_var_name': buchstabe_vier_var_name,
            'buchstabe_fuenf_var_id': buchstabe_fuenf_var_id,
            'buchstabe_fuenf_var_name': buchstabe_fuenf_var_name,
            'buchstabe_sechs_var_id': buchstabe_sechs_var_id,
            'buchstabe_sechs_var_name': buchstabe_sechs_var_name,
            'charm_id': charm_id,
            'anhaenger': anhaenger
        },
        success: function(data) {
            console.log(data);
        },
        error: function(errorThrown){
            console.log(errorThrown);
        }
    });

    $("#cart-success").css("display", "block");
    $(".modal-ov").css("display", "block");
}

All the data options should be normal strings. 所有数据选项应为普通字符串。

I would be grateful for any idea! 我将不胜感激!

Many thanks in advance, Marvin 预先感谢,马文


EDIT: 编辑:

This is the full error: 这是完整的错误:

insertAdjacentElement, jquery.js:3:24987
e, jquery.js:3:24987
dc, jquery.js:3:24872
dc, jquery.js:3:24896
param, query.js:3:25234
ajax, jquery.js:3:21049
letsOrder, konfigurator.js:519
(anonyme Funktion), konfigurator.js:464
dispatch, jquery-latest.min.js:2:8441
handle, jquery-latest.min.js:2:5144

This is the affected website. 是受影响的网站。 The error appears when you click on "Halsband bestellen" directly under the price (Just in Safari) 当您直接在价格下单击“ Halsband bestellen”时出现错误(仅在Safari中)

The error was caused by the plugin "Page scroll to id"... (the simplest plugin of all). 该错误是由“页面滚动到ID”插件(所有插件中最简单的插件)引起的。

Many thanks for your quick answers! 非常感谢您的快速解答! Otherwise i would still search in my own js-file. 否则,我仍然会在自己的js文件中进行搜索。

Marvin 马文

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

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