Ciao a tutti o questo tag html:

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