I'm getting a error on the console when executing this code. Basically I want to send a console log when clicking on a button.
var send = document.getElementById("sendButton");
send.addEventListener("click", function () {
console.log("text");
});
<button id="sendButton">Submit</button>
How can I resolve this?