diff --git a/site/public/order/dot-compliance/index.html b/site/public/order/dot-compliance/index.html index 22b2f13..12682e3 100644 --- a/site/public/order/dot-compliance/index.html +++ b/site/public/order/dot-compliance/index.html @@ -455,10 +455,12 @@ function fetchDiscount() { updateTotal(); }).catch(function() { activeDiscount = null; updateTotal(); }); } -// Fetch on load if promo pre-filled -if (promoFromUrl) { setTimeout(fetchDiscount, 500); } -// Fetch on blur of promo field -document.getElementById("pw-promo").addEventListener("blur", fetchDiscount); +// Fetch on load if promo field has any value +var promoField = document.getElementById("pw-promo"); +if (promoField.value.trim()) { setTimeout(fetchDiscount, 300); } +// Fetch on blur and input of promo field +promoField.addEventListener("blur", fetchDiscount); +promoField.addEventListener("input", function() { clearTimeout(promoField._debounce); promoField._debounce = setTimeout(fetchDiscount, 600); }); function updateTotal() { var selected = [];