Skip to content

UI/UX Improvement: Add "Press Enter to Send" Functionality #4

Description

@codeCraft-Ritik

Issue :

Users currently have to click a button to send messages. Most modern chat interfaces allow users to send messages by pressing the "Enter" key, which provides a smoother experience.

Recommendation : Add an event listener to the input field to detect the "Enter" key.

File Path : Chatbot-using-API/script.js

Code Snippet :

c```
onst chatInput = document.querySelector(".chat-input textarea");
chatInput.addEventListener("keydown", (e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleChat(); // Call your existing send function
}
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions