简体   繁体   中英

TypeError on jQuery click function

since any wordpress- or plugin-update one of my order-buttons dosen't work anymore.

Just in safari... Chrome & Firefox is still Ok.

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:

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)

The error was caused by the plugin "Page scroll to id"... (the simplest plugin of all).

Many thanks for your quick answers! Otherwise i would still search in my own js-file.

Marvin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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