function handleValidation(event,target){let isValid=!0,errorMessage="";toggleSubmitBtn(target.querySelector('[type="submit"]'),!0);const requiredInputs=target.querySelectorAll("input[required], select[required]");for(let input of requiredInputs)input.value.trim()||(isValid=!1,errorMessage+=`Please fill out the ${input.getAttribute("data-field-name")} field. `);target.querySelectorAll("fieldset[data-minimum-selection]").forEach(group=>{let checkboxes=group.querySelectorAll('input[type="checkbox"]');Array.from(checkboxes).filter(checkbox=>checkbox.checked).lengthSuccess!

Your form has been submitted successfully. Be sure to check your email to opt-in to receive exclusive content, offers, and more on the world's cleanest personal care devices.

`:parent.innerHTML=`

Success! Your referral code is:

Share the link TAOClean.com/referral to give 50% OFF to your friends and family on any TAO Clean device purchase!

Share via SMS
Share via Email
Share on Facebook
Share on Twitter
`}async function postFormData(form){const endpoint=form.getAttribute("data-form-endpoint");if(!endpoint)return;let formData=new FormData(form);formData.append("form-id",form.id);try{let data=await await fetch(endpoint,{method:"POST",body:formData});formSuccess(form)}catch(error){console.error("There was an issue submitting your form:",error),alert("There was an issue submitting your form. Please reload this page and try again.")}}function findForms(){document.querySelectorAll('form[data-custom-validation="true"]').forEach(form=>{form.addEventListener("submit",event=>{handleValidation(event,form)})})}document.addEventListener("DOMContentLoaded",findForms); //# sourceMappingURL=/cdn/shop/t/103/assets/custom-form-validation.js.map?v=169495347426558994421735865199