0

So, again I come here to ask you for help.

I'm using Apus RealState Template with WooCommerce. Everything was fine til I installed a payment gateway module...

Now, Wordpress logs the following to the console with every page I try to load:

Uncaught TypeError: Cannot read property 'includes' of undefined

at HTMLDocument. (erede.js:6)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)

(anonymous) @ erede.js:6
i @ jquery.js?ver=1.12.4:2
fireWith @ jquery.js?ver=1.12.4:2
ready @ jquery.js?ver=1.12.4:2
K @ jquery.js?ver=1.12.4:2

This is the context mentioned from erede.js:

(function( $ ) {
'use strict';

$( function() {

    var checkIfInputHasDefaultBehavior = $("#checkInputClass").css("background-image").includes("url");

    if(!checkIfInputHasDefaultBehavior)
    {   
        return;
    }

but when I change the template, this error stops happening... does anyone know what might be going on?

  • does erede.js belong to the template or the plugin? it could be a browser compatibility issue (does it support this method?) or it could be that that id is not being used. try using var checkIfInputHasDefaultBehavior = $("#checkInputClass").length && $("#checkInputClass").css("background-image").includes("url");. – inarilo Dec 12 '17 at 17:27
  • hey man, thank you very much for replying! I thought it were a conflict between template/payment plugin, but actually it is between the theme and WooCommerce... My payment methods box does not load fully (it loads, but it maintains a preloader overlaying/blocking the box). This only happens with the template mentioned... – Mateus Oliveira Dec 12 '17 at 17:30
  • did you try using the code i gave? did it help? – inarilo Dec 12 '17 at 18:35
  • wow man, sorry I did not, cause then I got really desperate when that conflict between WooCommerce and the template happened. but damn, I've just tested, and thanks man! tks a lot! it actually resolved the conflict between the plugin and the template, all the pages are loading perfeclty now, tks! – Mateus Oliveira Dec 12 '17 at 18:51
  • i'm adding it as an answer then :) – inarilo Dec 12 '17 at 19:00
0

It could either be a browser compatibility issue (does it support the includes method?) or it could be that the id checkInputClass is not being used. Change the first line of the js to the following to ensure the element exists before further checks are done:

var checkIfInputHasDefaultBehavior = $("#checkInputClass").length && $("#checkInputClass").css("background-image").includes("url"‌​);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.