From 28c60c791223477142113223cd698d9ce8799515 Mon Sep 17 00:00:00 2001 From: muli Date: Wed, 3 Aug 2022 19:32:09 +0200 Subject: [PATCH] fix: Remove opposite highlight classes to just display the most recent one. --- assets/js/contact_form.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/js/contact_form.js b/assets/js/contact_form.js index fcd7540..7a48e1f 100644 --- a/assets/js/contact_form.js +++ b/assets/js/contact_form.js @@ -49,6 +49,7 @@ contact_form.addEventListener('submit', function(event) { .then(json => { console.log(json); if (json.errors) { + feedback.classList.remove('--success'); feedback.classList.add('--error'); // Über errors iterieren und diese ausgeben (evtl. nur ersten Fehler ausgeben?) let error_message = ''; @@ -69,6 +70,7 @@ contact_form.addEventListener('submit', function(event) { }) feedback.innerHTML = error_message; } else if (json.status == 'ok') { + feedback.classList.remove('--error'); feedback.classList.add('--success'); feedback.textContent = "Deine Nachricht wurde erfolgreich ans Office geschickt."; }