JS error “SCRIPT1014: Invalid character”
-
Hello,
We seem to be facing a Javascript issue with Autoptimize installed on our website and the code seems to be coming from Phone Validator for Woocommerce plugin. The error in the console is
SCRIPT1014: Invalid character
. The error marked in the code is detailed (and marked in bold) below :var $=jQuery,wcPvPhoneErrorMap=wcPvJson.validationErrors;0==$(‘.wc-pv-intl input’).length&&$(‘#billing_phone_field’).addClass(‘wc-pv-phone wc-pv-intl’);
var wcPvDefCountry=''==wcPvJson.defaultCountry?$(${wcPvJson.parentPage} #billing_country).val():wcPvJson.defaultCountry;let separateDialCode=1==wcPvJson.separateDialCode
,onlyCountries=wcPvJson.onlyCountries.map(e=>e.toUpperCase());var wcPvPhoneIntl=$(‘.wc-pv-intl input’).intlTelInput({initialCountry:”==wcPvDefCountry||void 0==wcPvDefCountry?’NG’:wcPvDefCountry,onlyCountries:onlyCountries,separateDialCode:separateDialCode,preferredCountries:wcPvJson.preferredCountries,utilsScript:wcPvJson.utilsScript}),wcPvphoneErrMsg=”;function wcPvValidatePhone(e){const n=e;let o=!1;if(1==n.intlTelInput(‘isValidNumber’))o=n.intlTelInput(‘getNumber’);else{let e=n.intlTelInput(‘getValidationError’);wcPvphoneErrMsg=${wcPvJson.phoneErrorTitle+(void 0==wcPvPhoneErrorMap[e]?wcPvJson.phoneUnknownErrorMsg:wcPvPhoneErrorMap[e])};}return o;}function wcPvValidateProcess(e){let n=wcPvValidatePhone(wcPvPhoneIntl);0!=$(‘.wc-pv-intl input’).length&&($(‘#wc-ls-phone-valid-field-err-msg’).remove(),0!=n?($(${wcPvJson.parentPage} input#billing_phone).val(n),0==$(‘#wc-ls-phone-valid-field’).length&&e.append( <input id = “wc-ls-phone-valid-field” value = “${n}” type = “hidden” name = “${wcPvJson.phoneValidatorName}” > )):(e.append( <input id = “wc-ls-phone-valid-field-err-msg” value = “${wcPvphoneErrMsg}” type = “hidden” name = “${wcPvJson.phoneValidatorErrName}” > ),$(‘#wc-ls-phone-valid-field’).remove()));}if($(${wcPvJson.parentPage} #billing_country).change(function(){let e=$(this).val();onlyCountries.includes(e)&&wcPvPhoneIntl.intlTelInput(‘setCountry’,e);}),!0===separateDialCode&&$(‘.wc-pv-intl’).addClass(‘wc-pv-separate-dial-code’),’checkout’==wcPvJson.currentPage){let e=$(${wcPvJson.parentPage});e.on(‘checkout_place_order’,function(){wcPvValidateProcess(e);});}else if(‘account’==wcPvJson.currentPage){let e=$(${wcPvJson.parentPage} form);$(${wcPvJson.parentPage}).submit(function(){wcPvValidateProcess(e);});};
I am suspecting it has to do with the backticks(template literals) in the above marked code. What do you think it could be? Any help is appreciated let me know if you need any other details. Thanks!
- The topic ‘JS error “SCRIPT1014: Invalid character”’ is closed to new replies.