Ciao a tutti o questo tag html:
e questo js:codice HTML:<input type="text" name="msgChat" placeholder="Scrivi qui..." onkeyup="sendMsg();">
Ma quando lo eseguo mi compare tante alert quanti caratteri digito nel campo input invece mi dovrebbe dare solo 1 alertcodice:function sendMsg() { const sendKey = document.querySelector("input[name=msgChat]"); sendKey.addEventListener("keyup", (event) => { if (event.key === "Enter") alert(sendKey.value); }); }