Skip to content

Commit

Permalink
Now sending message with "Enter" key
Browse files Browse the repository at this point in the history
  • Loading branch information
Armancollab committed Jan 13, 2024
1 parent a6ea653 commit 0eaeb22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions templates/room.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ <h2>Chat Room: {{code}}</h2>
message.value = "";
};

document.getElementById('message').addEventListener('keydown', function (event) {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault();
sendMessage();
}
});


const leaveRoom = () => {
socketio.emit("leave", { data: "leave" });
window.location.href = "/";
Expand Down

0 comments on commit 0eaeb22

Please sign in to comment.