diff --git a/assets/js/checkout.js b/assets/js/checkout.js index f04ab7f..d27f6e5 100644 --- a/assets/js/checkout.js +++ b/assets/js/checkout.js @@ -12,8 +12,9 @@ function getAddressFiedlValue(addressComponents, $field){ } let input = document.querySelector("#ctelefon"); +let iti = null; if(input != undefined){ - let iti = window.intlTelInput(input, { + iti = window.intlTelInput(input, { initialCountry: "de", preferredCountries: ["de"], geoIpLookup: function(callback) { @@ -65,8 +66,6 @@ function updateProducts(){ } } -// iti.getNumber(); - $(window).on('load', function(){ updateProducts(); $("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); }); @@ -81,6 +80,7 @@ $(window).on('load', function(){ }); let cart = products.join(" - ")+" - Gesammt: "+numberToEuroFormat(totalPrice); $('#ccart').val(cart); + $('#ctelefon').val(iti.getNumber()); objProducts = []; localStorage.setItem("products", JSON.stringify(objProducts)); form.unbind('submit').submit();