
document.querySelectorAll('.message-button, .rolex-button-back-form').forEach(function(element) {
element.addEventListener('click', function(event) {
if(document.querySelector('textarea').value) {
var showSection = document.querySelector('.show-section-form');
var hideSection = document.querySelector('.hide-section-form');
showSection.classList.remove("show-section-form");
showSection.classList.add("hide-section-form");
hideSection.classList.remove("hide-section-form");
hideSection.classList.add("show-section-form");
} else {
document.querySelector('.rolex-textarea .bfb-error').innerHTML = '
Error: please input text.
';
}
});
});
document.querySelector('#rolex-contant-submit button').addEventListener('click', function(event) {
const inputEmail = document.querySelector('#rolex-contact-email input');
const inputPhone = document.querySelector('#rolex-contact-phone input');
const errorEmail = document.querySelector('#rolex-contact-email .bfb-error');
const rolexHeading = document.querySelector('.rolex-form-heading');
const rolexSubheading = document.querySelector('.rolex-form-subheading');
if(inputEmail.value || inputPhone.value) {
errorEmail.innerHTML = '';
if (rolexHeading) {
rolexHeading.style.display = "none";
}
} else {
event.preventDefault();
event.stopImmediatePropagation();
errorEmail.innerHTML = 'Error: please input email address and/or phone.
';
}
if (rolexSubheading) {
rolexSubheading.style.display = "none";
}
}) ;