From a09422feded49868a965c7a5591aa2dfbdbc9eca Mon Sep 17 00:00:00 2001 From: Nayan khuje Date: Mon, 11 Nov 2024 00:35:20 +0530 Subject: [PATCH] added enter button key board functinality of chatbot massege send section --- chatbot.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chatbot.html b/chatbot.html index a1758120..0929e3d5 100644 --- a/chatbot.html +++ b/chatbot.html @@ -457,6 +457,14 @@ recognition.addEventListener('error', (event) => { console.error('Speech recognition error:', event.error); // Log any errors }); + + document.getElementById("prompt-input").addEventListener("keypress", function(event) { + if (event.key === "Enter") { + event.preventDefault(); // Prevents the default action of the Enter key + document.getElementById("generate-btn").click(); // Programmatically clicks the send button + } +}); +