Page 1 of 1

JavaScript Popup wird beim ersten Klick nicht geplant

Posted: 09 Feb 2025, 08:35
by Guest
Mein JavaScript -Popup startet nicht beim ersten Klick. Es funktioniert jedoch am 2. Klick. />

Code: Select all

document.querySelector(".chatButtons").addEventListener("click", myFunction);

function myFunction() {

var chatModal = document.getElementById("myForm");

if (chatModal.style.display === "none" || chatModal.style.display === " ") {
chatModal.style.display = "block";

} else {
chatModal.style.display = "none";
}
}< /code>
#myForm { display: none; }< /code>
button



Form here