Skip to content

Commit

Permalink
refactor (modal) : recup form inputs values in log (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
codexarama committed May 10, 2021
1 parent 480ec54 commit ef68a75
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions js/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,9 @@ closeModalBtn.forEach((btn) =>
)
);

// CONFIRMATION D'ENVOI DU MESSAGE
form.addEventListener('submit', function (e) {
if (checkValidity) {
modalBody.style.display = 'none';
confirm.style.opacity = '1';
form.reset();
}
});

// VERIFICATION DES SAISIES
const inputs = document.querySelectorAll('input');
const textarea = document.querySelectorAll('textarea');
console.log(textarea.value);

const checkValidity = (input) => {
input.addEventListener('invalid', (e) => {
Expand Down Expand Up @@ -95,12 +85,7 @@ const dataSuccess = (input, message) => {
small.innerText = message;
};

// recuperation des saisies
Array.from(inputs).forEach(checkValidity);
Array.from(textarea).forEach(checkValidity);

// AFFICHE LES SAISIES DANS LA CONSOLE
// ---------- NE FONCTIONNE PAS ---------- //
form.addEventListener('submit', function (e) {
e.preventDefault();
console.log(`Prénom : ${firstName.value}`);
Expand Down

0 comments on commit ef68a75

Please sign in to comment.