script>
document.addEventListener("DOMContentLoaded", function() {
// 1. Получаем email из адресной строки
const urlParams = new URLSearchParams(window.location.search);
const emailValue = urlParams.get('email');
if (emailValue) {
// 2. Ищем поле ввода email (с учетом специфики Tilda)
const emailInputs = document.querySelectorAll('input[name="Email" i], input[type="email"], input[name="email"]');
// 3. Заполняем все найденные поля на странице
emailInputs.forEach(function(input) {
input.value = decodeURIComponent(emailValue);
// Активируем событие изменения, чтобы Tilda поняла, что поле заполнено
input.dispatchEvent(new Event('change', { bubbles: true }));
});
console.log("Email успешно подставлен в формы Tilda:", decodeURIComponent(emailValue));
}
});