Вот пример фрагмента кода, который вы можете использовать для достижения желаемой функциональности добавления электронного письма из поля ввода при нажатии кнопки «Подписаться» на веб-сайте Wix:
// Add this code to the page's code section or an external JavaScript file
// This function is called when the "Subscribe" button is clicked
function subscribeButtonClicked() {
// Get the email input element
var emailInput = document.getElementById('emailInput');
// Get the entered email value
var email = emailInput.value;
// Perform any necessary validations on the email value here
// Add your code to process the email (e.g., send it to a server, store it in a database, etc.)
// Clear the email input field
emailInput.value = '';
// Optionally, you can show a success message or perform other actions here
}
На вашем веб-сайте Wix вам необходимо добавить поле ввода с идентификатором «emailInput» и кнопку с событием onclick, установленным на «subscribeButtonClicked()». Убедитесь, что поле ввода и кнопка имеют соответствующий стиль, соответствующий дизайну вашего сайта.