document.addEventListener("DOMContentLoaded", function() { var allowedDomains = ['example.com', 'alloweddomain.org', 'trustedsource.net']; // Select the form. If there are multiple forms, you may need to use a more specific selector. var forms = document.querySelectorAll('.sqs-block-form'); forms.forEach(function(form) { form.addEventListener('submit', function(event) { // Find the email input within this form var emailInput = form.querySelector('input[type="email"]'); if (emailInput) { var emailValue = emailInput.value; var domain = emailValue.split('@')[1]; if (!allowedDomains.includes(domain)) { event.preventDefault(); // Stop the form from submitting alert('The email address is not allowed. Please use an email from the following domains: ' + allowedDomains.join(', ')); } } }); }); });